mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
preserve webpack dynamic requires
This commit is contained in:
parent
ef072d972c
commit
e17b0c5787
@ -60,6 +60,16 @@ export const getRollupConfig = (config) => {
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// Preserve dynamic require
|
||||||
|
// https://github.com/rollup/plugins/tree/master/packages/replace
|
||||||
|
options.output.intro += 'const requireDynamic = require;'
|
||||||
|
options.plugins.push(replace({
|
||||||
|
values: {
|
||||||
|
'require("./"': 'requireDynamic("./"'
|
||||||
|
},
|
||||||
|
delimiters: ['', '']
|
||||||
|
}))
|
||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/alias
|
// https://github.com/rollup/plugins/tree/master/packages/alias
|
||||||
options.plugins.push(alias({
|
options.plugins.push(alias({
|
||||||
entries: {
|
entries: {
|
||||||
@ -93,8 +103,7 @@ export const getRollupConfig = (config) => {
|
|||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
||||||
options.plugins.push(commonjs({
|
options.plugins.push(commonjs({
|
||||||
extensions: extensions.filter(ext => ext !== '.json'),
|
extensions: extensions.filter(ext => ext !== '.json')
|
||||||
dynamicRequireTargets: ['*.js']
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/json
|
// https://github.com/rollup/plugins/tree/master/packages/json
|
||||||
|
Loading…
Reference in New Issue
Block a user