perf[chore]: webpack
This commit is contained in:
parent
e504ae533a
commit
56f67f0538
|
@ -3,7 +3,6 @@ const path = require('path')
|
|||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const vueLoaderConfig = require('./vue-loader.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, '..', dir)
|
||||
|
@ -87,13 +86,6 @@ module.exports = {
|
|||
}
|
||||
]
|
||||
},
|
||||
plugins:[
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: 'static/tinymce'
|
||||
}
|
||||
])
|
||||
],
|
||||
node: {
|
||||
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
||||
// source contains it (although only uses it if it's native).
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const path = require('path')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
||||
const portfinder = require('portfinder')
|
||||
|
@ -26,8 +27,13 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
|||
// these devServer options should be customized in /config/index.js
|
||||
devServer: {
|
||||
clientLogLevel: 'warning',
|
||||
historyApiFallback: true,
|
||||
historyApiFallback: {
|
||||
rewrites: [
|
||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
|
||||
],
|
||||
},
|
||||
hot: true,
|
||||
contentBase: false, // since we use CopyWebpackPlugin.
|
||||
compress: true,
|
||||
host: HOST || config.dev.host,
|
||||
port: PORT || config.dev.port,
|
||||
|
@ -57,6 +63,14 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
|||
favicon: resolve('favicon.ico'),
|
||||
title: 'vue-element-admin'
|
||||
}),
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.dev.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
|
|
|
@ -127,6 +127,14 @@ const webpackConfig = merge(baseWebpackConfig, {
|
|||
var context = module.context;
|
||||
return context && (context.indexOf('xlsx') >= 0);
|
||||
}
|
||||
}),
|
||||
// split tinymce into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
async: 'tinymce',
|
||||
minChunks(module) {
|
||||
var context = module.context;
|
||||
return context && (context.indexOf('tinymce') >= 0);
|
||||
}
|
||||
}),
|
||||
// split codemirror into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
// Import Tinymce
|
||||
import tinymce from 'tinymce/tinymce'
|
||||
|
||||
tinymce.baseURL = 'static/tinymce'
|
||||
|
||||
// A theme is also required
|
||||
import 'tinymce/themes/modern/theme'
|
||||
|
||||
|
|
Loading…
Reference in New Issue