vue-multipage
vue-multipage copied to clipboard
多页面配置生成的html报错
你好,参照你的配置想配置vue的多页面应用,在生成html报错,初步确定是html-webpack-plugin的原因,在网上一直没找到原因,所以想您帮忙看一下,您有空帮忙能帮忙看一下吗,下面是报错生成的html Html Webpack Plugin:
TypeError: __webpack_require__(...) is not a function - index.html:720 Object.define D:/WebstormProjects/workspace/app/my/athena-app/src/settlement/index.html:720:78 - index.html:620 __webpack_require__ D:/WebstormProjects/workspace/app/my/athena-app/src/settlement/index.html:620:30 - index.html:48 fn D:/WebstormProjects/workspace/app/my/athena-app/src/settlement/index.html:48:20 - index.html:9415 Object.D:/WebstormProjects/workspace/app/my/athena-app/src/settlement/index.html:9415:56 - index.html:620 __webpack_require__ D:/WebstormProjects/workspace/app/my/athena-app/src/settlement/index.html:620:30 - index.html:48 fn 这边是我的webpack配置 var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') var path = require('path') var HtmlWebpackPlugin = require('html-webpack-plugin') var merge = require('webpack-merge'); var utils = require('./config/utils.js') var webpack = require('webpack') function resolve(dir) { return path.resolve(__dirname, dir) } var baseConfig = { entry: utils.getEntry(), output: { path: path.join(__dirname, 'dist'), publicPath: '/dist/', filename: '[name].build.js', }, node: { fs: 'empty' }, module: { rules: [ { test: /\.js$/, loaders: 'imports-loader?define=>false!babel-loader', }, { test: /\.vue$/, loader: 'vue-loader', options: { loaders: { scss: 'vue-style-loader!css-loader!sass-loader', sass: 'vue-style-loader!css-loader!sass-loader', }, postcss: [ require('autoprefixer')({ browsers: ['last 2 versions'] }) ] } }, { test: /\.s[a|c]ss$/, use: [ 'style-loader', 'css-loader', 'sass-loader' ] }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, loader: 'url-loader', query: { limit: 10000, name: 'img/[name].[hash:7].[ext]' } }, ] }, resolve: { alias: { 'vue$': 'vue/dist/vue.common.js', }, aliasFields: ["browser"], extensions: ['.js', '.vue'] } } var webpackConfig = merge(baseConfig, { plugins: [ new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false, }, mangle: true, comments: false }), new webpack.optimize.OccurrenceOrderPlugin(), new webpack.optimize.CommonsChunkPlugin({ name: "commons", minChunks: 5 } ), new webpack.DllReferencePlugin({ context: __dirname, /** * 在这里引入 manifest 文件 */ manifest: require('./dist/vendor-manifest.json') }), new webpack.optimize.AggressiveMergingPlugin(), new webpack.DefinePlugin({ PRODUCTION: JSON.stringify(true) }), new webpack.HotModuleReplacementPlugin(), new webpack.NoEmitOnErrorsPlugin(), new FriendlyErrorsPlugin() ].concat(utils.getHtmlPlugin()) }) console.log(utils.getHtmlPlugin()) console.log(utils.getEntry()) module.exports = webpackConfig