1

I wanted to pull out the dependency packages, but I had a problem. with vue/cli3.0

online link is https://github.com/Sayid1/dll-test

main code

vue.config.js

var bundleConfig = require('./bundle-config.json')

module.exports = {
  configureWebpack: {
    plugins: [
      new webpack.DllReferencePlugin({
        manifest: require('./dll/manifest.json')
      }),
      new HtmlWebpackPlugin({
        inject: true,
        template: './public/index.html',
        filename: 'index.html',
        vendorJsName: bundleConfig.vender.js,
      })
    ]
  }
}

webpack.config.dll.js

const AssetsPlugin = require('assets-webpack-plugin')

module.exports = {
  entry: {
    vender: ['vue/dist/vue.runtime.common.js']
  },
  output: {
    path: path.join(__dirname, 'dll'),
    filename: 'dll.[name]_[hash].js',
    library: '[name]_[hash]'
  },
  plugins: [
    new webpack.DllPlugin({
      name: '[name]_[hash]',
      path: path.join(__dirname, 'dll', 'manifest.json')
    }),
    new AssetsPlugin({
      filename: 'bundle-config.json',
      path: './'
    })
  ]
}

i run this script:

webpack -p --progress --config webpack.config.dll.js

then start up server

an error has occurred.

Uncaught SyntaxError: Unexpected token <

Uncaught ReferenceError: vender_87f3be8acd6aadd91537 is not defined
    at eval (eval at dll-reference vender_87f3be8acd6aadd91537 (app.js:2106), <anonymous>:1:18)
    at Object.dll-reference vender_87f3be8acd6aadd91537 (app.js:2106)
    at __webpack_require__ (app.js:724)
    at fn (app.js:101)
    at eval (global.js from dll-reference vender_87f3be8acd6aadd91537?478a:1)
    at Object../node_modules/webpack/buildin/global.js (app.js:1896)
    at __webpack_require__ (app.js:724)
    at fn (app.js:101)
    at eval (punycode.js:521)
    at Object../node_modules/node-libs-browser/node_modules/punycode/punycode.js (app.js:1685)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.