Skip to content

Commit

Permalink
override defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed Feb 20, 2021
1 parent 498950b commit 4f6003d
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,32 @@ module.exports = async (
// Common config for every env.
// prettier-ignore
let configRules = [
// Webpack expects extensions when importing ESM modules as that's what the spec describes.
// Not all libraries have adapted so we don't enforce its behaviour
// @see https://github.com/webpack/webpack/issues/11467
{
test: /\.mjs$/i,
resolve: {
byDependency: {
esm: {
fullySpecified: false
}
}
}
},
{
test: /\.js$/i,
descriptionData: {
type: `module`
},
resolve: {
byDependency: {
esm: {
fullySpecified: false
}
}
}
},
rules.js({
modulesThatUseGatsby,
}),
Expand Down Expand Up @@ -414,13 +440,6 @@ module.exports = async (
"react-dom": getPackageRoot(`react-dom`),
},
plugins: [new CoreJSResolver()],
// https://webpack.js.org/configuration/module/#resolvefullyspecified
// Does not force extensions for ESM modules
byDependency: {
esm: {
fullySpecified: false,
},
},
}

const target =
Expand Down

0 comments on commit 4f6003d

Please sign in to comment.