|
@@ -3,9 +3,10 @@ const path = require('path');
|
|
|
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
const WebpackDevServer = require('webpack-dev-server');
|
|
|
-const entries = require('./entry.js');
|
|
|
+const entries = require('./webpack/entry.config.js');
|
|
|
const version = require('./package.json').version;
|
|
|
const argv = require('yargs').argv;
|
|
|
+const dirVars = require('./webpack/dir.config.js');
|
|
|
|
|
|
let theme = {
|
|
|
'@primary-color': '#58a3ff',
|
|
@@ -15,7 +16,14 @@ let isWatch = argv.env.deploy == 'watch';
|
|
|
let isDev = isWatch || argv.env.deploy == 'dev';
|
|
|
|
|
|
module.exports = (function () {
|
|
|
+ var dllContext = path.resolve(dirVars.dllDir, './' + argv.env.deploy);
|
|
|
let plugins = [
|
|
|
+ /* 配置好Dll */
|
|
|
+ new webpack.DllReferencePlugin({
|
|
|
+ context: dirVars.staticRootDir, // 指定一个路径作为上下文环境,需要与DllPlugin的context参数保持一致,建议统一设置为项目根目录
|
|
|
+ manifest: path.resolve(dllContext, 'manifest.json'), // 指定manifest.json
|
|
|
+ name: 'dll', // 当前Dll的所有内容都会存放在这个参数指定变量名的一个全局变量下,注意与DllPlugin的name参数保持一致
|
|
|
+ }),
|
|
|
new ExtractTextPlugin({
|
|
|
filename: "[name].css",
|
|
|
disable: false,
|
|
@@ -215,59 +223,7 @@ module.exports = (function () {
|
|
|
publicPath: staticHost,
|
|
|
chunkFilename: 'chunks/[name].[hash:8].js'
|
|
|
},
|
|
|
- module: {
|
|
|
- rules: [{
|
|
|
- test: /\.jsx?$/,
|
|
|
- exclude: /node_modules/,
|
|
|
- use: {
|
|
|
- loader: 'babel-loader',
|
|
|
- options: {
|
|
|
- "presets": ["es2015", "react"],
|
|
|
- "plugins": [
|
|
|
- ["antd", {
|
|
|
- "style": true
|
|
|
- }]
|
|
|
- ]
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- test: /\.less$/,
|
|
|
- use: ExtractTextPlugin.extract({
|
|
|
- fallback: 'style-loader',
|
|
|
- use: [{
|
|
|
- loader: 'css-loader',
|
|
|
- options: {
|
|
|
- importLoaders: 1
|
|
|
- }
|
|
|
- }, {
|
|
|
- loader: 'less-loader',
|
|
|
- options: {
|
|
|
- modifyVars: theme
|
|
|
- }
|
|
|
- }]
|
|
|
- })
|
|
|
- }, {
|
|
|
- test: /\.(png|jpg)$/,
|
|
|
- use: [{
|
|
|
- loader: 'url-loader',
|
|
|
- options: {
|
|
|
- limit: 8192,
|
|
|
- name: '[path][name].[ext]'
|
|
|
- }
|
|
|
- }]
|
|
|
- }, {
|
|
|
- test: /\.(woff|svg|eot|ttf)$/,
|
|
|
- use: [{
|
|
|
- loader: 'url-loader',
|
|
|
- options: {
|
|
|
- limit: 1,
|
|
|
- name: '[path][name].[ext]'
|
|
|
- }
|
|
|
- }]
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
+ module: require('./webpack/module.config.js')(theme),
|
|
|
resolve: {
|
|
|
extensions: ['.js', '.jsx']
|
|
|
},
|