const path = require('path');
const webpack = require('webpack')
const speedMeasurePlugin = require('speed-measure-webpack-plugin')
const smp = new speedMeasurePlugin({
disable:true,
})
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const CopyWebpackPlugin = require('copy-webpack-plugin')
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
module.exports = {
publicPath: './',
configureWebpack: smp.wrap({
resolve: {
alias: {
'src': path.resolve(__dirname, './src'),
'assets': path.resolve(__dirname, './src/assets'),
'components': path.resolve(__dirname, './src/components')
}
},
plugins:[
// new BundleAnalyzerPlugin(),
new webpack.DllReferencePlugin({
context:__dirname,
manifest:path.resolve(__dirname,'./dll/vue_manifest.json')
}),
new CopyWebpackPlugin({
patterns:[
{
from:path.resolve(__dirname,'./dll/vue.dll.js'),
to:path.resolve(__dirname,'./dist/js/vue.dll.js')
},
],
}),
new AddAssetHtmlPlugin({
filepath:path.resolve(__dirname,'./dll/vue.dll.js')
})
],
module: {
rules: [
{
test: /\.js$/,
exclude:/node_modules/,
// include: path.resolve('src'),
use: [{
loader:"thread-loader",
options:{
worker:2
},
},
// 耗时的 loader (例如 babel-loader)
],
},
],
},
})
// configureWebpack: {
// resolve: {
// alias: {
// 'src': path.resolve(__dirname, './src'),
// 'assets': path.resolve(__dirname, './src/assets'),
// 'components': path.resolve(__dirname, './src/components')
// }
// },
// }
}
{
"name": "elm",
"version": "2.0.1",
"description": "vue2-elm",
"author": "cangdu <1264889788@qq.com>",
"private": true,
"license": "GPL",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"ddl": "webpack --config build/webpack.ddl.config.js"
},
"dependencies": {
"better-scroll": "1.15.2",
"fastclick": "^1.0.6",
"iscroll": "^5.2.0",
"showdown": "^1.6.4",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0",
"vuex": "^4.0.0-0"
},
"devDependencies": {
"@vue/cli-service": "5.0.0-beta.2",
"@vue/compiler-sfc": "^3.2.6",
"add-asset-html-webpack-plugin": "^5.0.2",
"copy-webpack-plugin": "^9.1.0",
"html-webpack-plugin": "^5.5.0",
"postcss": "^8.4.12",
"postcss-cli": "^9.1.0",
"sass": "^1.49.7",
"sass-loader": "^12.4.0",
"speed-measure-webpack-plugin": "^1.5.0",
"thread-loader": "^3.0.4",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
}
}
已经将所有的measure关闭了,无法正确将vue.ddl.js 添加到index.html中