v2.1 version is released. For details, please see: https://github.com/elunez/eladmin-qd/releases/tag/v2.1

This commit is contained in:
zhengjie
2019-06-30 08:33:22 +08:00
parent 6a06c4a93c
commit 6622ccdb6a
4 changed files with 34 additions and 15 deletions

View File

@@ -3,7 +3,10 @@ const path = require('path')
const utils = require('./utils')
const config = require('../config')
const { VueLoaderPlugin } = require('vue-loader')
const vueLoaderConfig = require('./vue-loader.conf')
const os = require('os');
const HappyPack = require('happypack');
const happThreadPool = HappyPack.ThreadPool({size: os.cpus().length});
function resolve(dir) {
return path.join(__dirname, '..', dir)
@@ -21,6 +24,7 @@ const createLintingRule = () => ({
})
module.exports = {
cache: true,
context: path.resolve(__dirname, '../'),
entry:["babel-polyfill","./src/main.js"],
output: {
@@ -32,9 +36,11 @@ module.exports = {
: config.dev.assetsPublicPath
},
resolve: {
modules: [path.resolve(__dirname, '../node_modules')],
extensions: ['.js', '.vue', '.json'],
alias: {
'@': resolve('src')
'@': resolve('src'),
api: path.resolve(__dirname, '../src/api')
}
},
module: {
@@ -43,16 +49,19 @@ module.exports = {
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
options: {
loaders: {
js: 'happypack/loader?id=js' // 将loader换成happypack
}
}
},
{
test: /\.js$/,
loader: 'babel-loader?cacheDirectory',
loader: ['happypack/loader?id=js'], // 将loader换成happypack
include: [
resolve('src'),
resolve('test'),
resolve('node_modules/webpack-dev-server/client')
]
resolve('src')
], // src是项目开发的目录
exclude: [path.resolve('../node_modules')] // 不需要编译node_modules下的js
},
{
test: /\.svg$/,
@@ -89,7 +98,15 @@ module.exports = {
}
]
},
plugins: [new VueLoaderPlugin()],
plugins: [
new VueLoaderPlugin(),
new HappyPack({
id: 'js',
cache: true,
loaders: ['babel-loader?cacheDirectory=true'],
threadPool: happThreadPool
})
],
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).