Unable to build when .parcelrc does not define extends #4697
-
🐛 bug reportThe build fails with the config and command below: parcel build src/index.html --no-source-maps 🎛 Configuration (.babelrc, package.json, cli command)
{
"namers": ["@parcel/namer-default"]
}
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-transform-runtime",
[
"module-resolver",
{
"alias": {
"@myorg": "../common/src"
}
}
]
]
} But when I update {
"extends": "@parcel/config-default",
"namers": ["@parcel/namer-default"]
} 🤔 Expected BehaviorThe build should run successfully with 😯 Current Behavior
💁 Possible SolutionI'm not sure if it's intended or not that If it's not intended, then the solution would be to make the build pass when 🔦 ContextI was trying to create {
"namers": ["@parcel/namer-default"]
} 💻 Code Sample🌍 Your Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Extends is required if you want to extend the default config which is the case for you. The following config you wanted to use would not do anything as it has no transformers, packagers, bundlers, ... configured.
You can add all these things in the config if you want but in your case you probably just want a custom namer or something with the default behaviour for everything else. That's why the extends field exists to prevent you from having to go through all the trouble of creating your own config from scratch. |
Beta Was this translation helpful? Give feedback.
-
I see. Thank you so much for your answer! 🙇 Does this mean if I want to add an extra reporter, I'd have to look up https://github.com/parcel-bundler/parcel/blob/v2/packages/configs/default/index.json and put every reporter there in my config, then add my extra reporter afterward? {
"extends": "@parcel/config-default",
"reporters": [
"@parcel/reporter-cli",
"@parcel/reporter-dev-server",
"@parcel/reporter-bundle-analyzer",
"@parcel/reporter-bundle-buddy",
"parcel-reporter-extra-report"
]
} I wonder, wouldn't this make it hard to keep the list in |
Beta Was this translation helpful? Give feedback.
-
Do this (works for nearly every plugin type): {
"extends": "@parcel/config-default",
"reporters": ["...", "parcel-reporter-extra-report"]
} |
Beta Was this translation helpful? Give feedback.
-
I see! Thank you so much! I saw that this |
Beta Was this translation helpful? Give feedback.
-
Chiming in almost a year later to say that .extends should default to "@parcel/config-default", since that will be by far the most common case. |
Beta Was this translation helpful? Give feedback.
Extends is required if you want to extend the default config which is the case for you.
The following config you wanted to use would not do anything as it has no transformers, packagers, bundlers, ... configured.
You can add all these things in the config if you want but in your case you probably just want a custom namer or something with the default behaviour for everything else. That's why the extends field exists to prevent you from having to go through all the trouble of creating your own config from scratch.