Search code examples
reactjsparceljs

Parcel - Invalid Config from config-default?



Hi everyone!
Recently I'm running into an error when trying to run my React app in Parcel that says I have an invalid config for the compressor, but I haven't changed anything from the default configurations. I've tried reinstalling but the same error occurs.
Here's the error I'm getting:
@parcel/core: Invalid Parcel Config

node_modules/@parcel/config-default/index.json:149:2
  148 |   },
> 149 |   "compressors": {
>     |   ^^^^^^^^^^^^^ Possible values: "extends", "validators", "filePath", "resolveFrom"
  150 |     "*": [
  151 |       "@parcel/compressor-raw"

This is what is in the index.json for @parcel:

"compressors": {
  "*": [
  "@parcel/compressor-raw"
  ]
},

I've tried searching for this as a bug, but didn't find any results?
Thanks for your help!


Solution

  • Here's what worked for me:

    1. Remove this "@parcel/transformer-sass": "^2.0.0-rc.0" dev dependency from package.json file if it is there and delete the node_module folder.

    2. Run this command to install dependencies: npm install

    3. Run this command to install Parcel and Parcel/transformer-sass: npm install --save-dev parcel @parcel/transformer-sass

    4. In package.json file, change the line "main": "src/index.html", to "source": "src/index.html". In the same file, add the following scripts in the scripts. "start": "parcel", "build": "parcel build"

    5. In the index.html file, add this type="module" attribute to the script tag. e.g. <script type="module" src="index.jsx"></script>

    6. After this, use the start script to start the app. e.g. npm run start