__webpack_require__(...) is not a function

Posted 目之所及,行之所至

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了__webpack_require__(...) is not a function相关的知识,希望对你有一定的参考价值。

使用webpack.DllReferencePlugin打包vue报错

 

 之后看了官方文档,多写一个context属性,在打包运行就OK了

生成DLL文件的配置文件 webpack.vendor.config.js

const path = require(\'path\')

const webpack = require(\'webpack\')

module.exports = {
  mode: \'development\',
  entry: {
    vue: [
      \'vue/dist/vue.js\',
      \'vue-router\'
    ]

  },
  output: {
    path: path.resolve(__dirname, \'../dist\'),
    filename: \'[name]_dll.js\',
    library: \'[name]_dll\' // 会在全局暴露出vue_dll对象
  },

  plugins: [
    new webpack.DllPlugin({
      context: __dirname,
      name: \'[name]_dll\',
      path: path.resolve(__dirname, \'../dist/manifest.json\')
    })
  ]
}

 

webpack打包配置文件 webpack.config.js

插件中

new webpack.DllReferencePlugin({
      context: __dirname,
      manifest: path.resolve(__dirname, \'../dist/manifest.json\')
    }),

以上是关于__webpack_require__(...) is not a function的主要内容,如果未能解决你的问题,请参考以下文章

__webpack_require__(...) is not a function

webpack 懒加载原理

webpack 懒加载原理

[webpack] devtool里的7种SourceMap[转]

抽象语法树

抽象语法树