Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Plugin must respect the 'target': 'node' for SSR setup of vue-cli and 'externals' #28

Open
Arsync opened this issue May 23, 2019 · 1 comment

Comments

@Arsync
Copy link

Arsync commented May 23, 2019

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.

@fingerpan
Copy link
Owner

Yes, you are right. I will solve this problem.
Thank you for your guidance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants