mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Make browser side resolve prefer mjs files (#5898)
This commit is contained in:
parent
be24aaa0d2
commit
059dd309c5
|
@ -210,7 +210,7 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer
|
||||||
|
|
||||||
const resolveConfig = {
|
const resolveConfig = {
|
||||||
// Disable .mjs for node_modules bundling
|
// Disable .mjs for node_modules bundling
|
||||||
extensions: ['.wasm', '.js', '.mjs', '.jsx', '.json'],
|
extensions: isServer ? ['.wasm', '.js', '.mjs', '.jsx', '.json'] : ['.wasm', '.mjs', '.js', '.jsx', '.json'],
|
||||||
modules: [
|
modules: [
|
||||||
NEXT_PROJECT_ROOT_NODE_MODULES,
|
NEXT_PROJECT_ROOT_NODE_MODULES,
|
||||||
'node_modules',
|
'node_modules',
|
||||||
|
@ -219,7 +219,7 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer
|
||||||
alias: {
|
alias: {
|
||||||
next: NEXT_PROJECT_ROOT
|
next: NEXT_PROJECT_ROOT
|
||||||
},
|
},
|
||||||
mainFields: [!isServer && 'browser', !isServer && 'module', 'main'].filter(Boolean)
|
mainFields: isServer ? ['main'] : ['browser', 'module', 'main']
|
||||||
}
|
}
|
||||||
|
|
||||||
const webpackMode = dev ? 'development' : 'production'
|
const webpackMode = dev ? 'development' : 'production'
|
||||||
|
|
Loading…
Reference in a new issue