vue-cli-plugin-dll
vue-cli-plugin-dll copied to clipboard
Plugin must respect the 'target': 'node' for SSR setup of vue-cli and 'externals'
Example config of SSR setup: vue-cli-ssr-example and vue-cli3-ssr-project.
There is important things:
configureWebpack: () => ({
target: TARGET_NODE ? 'node' : 'web',
node: TARGET_NODE ? undefined : false,
entry: {
[target]: [`./src/entry-${target}`]
},
output: {
libraryTarget: TARGET_NODE
? 'commonjs2'
: undefined
}
// ...
}
And dll-plugin must not extract (or do it somehow else) vendors when running in server-side mode - there is one solid file as the server-entry result: 'vue-ssr-server-bundle.json'. No 'dll_library' variable. Maybe it can work as 'webpack-node-externals' - packages (except the whitelist of forced-transpilation, respect the externals
property of webpack config) on the server-side must be taken directly from node_modules folder. It's all there.
Stack trace:
NodeInvocationException: dll_library is not defined
ReferenceError: dll_library is not defined
at eval (eval at dll-reference dll_library (server.js:748:1), <anonymous>:1:18)
at Object.dll-reference dll_library (server.js:748:1)
at __webpack_require__ (server.js:27:30)
at eval (webpack-internal:///./node_modules/vuetify/lib/index.js:1:19)
at Object../node_modules/vuetify/lib/index.js (server.js:319:1)
at __webpack_require__ (server.js:27:30)
at eval (webpack-internal:///./src/plugins/vuetify.js:4:69)
at Module../src/plugins/vuetify.js (server.js:497:1)
at __webpack_require__ (server.js:27:30)
at eval (webpack-internal:///./src/app.js:11:74)
Temporary solution is to set open: !TARGET_NODE && IS_DEVELOPMENT
to disable plugin on server side.
Yes, you are right. I will solve this problem. Thank you for your guidance.