Skip to content

Commit

Permalink
update:Exclude css file
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyangguo committed Apr 20, 2018
1 parent 1509f94 commit 90c1f24
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "index.js",
"scripts": {
"dev": "webpack-dev-server --mode development --progress --hot",
"build": "rm -rf dist && NODE_ENV=production webpack --mode production --progress && cp -R public/* ./dist/ "
"build": "rm -rf dist && NODE_ENV=production webpack --mode production --progress && cp -R public/* ./dist/ && rm -rf dist/themes.bundle.js"
},
"author": "Godfery <hiyangguo@qq.com>",
"license": "MIT",
Expand Down
3 changes: 0 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import ReactDOM from 'react-dom';

// style
import './less/index.less';
import './less/themes/green.less';
import './less/themes/red.less';
import './less/themes/yellow.less';

import App from './App';

Expand Down
3 changes: 3 additions & 0 deletions src/themes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './less/themes/green.less';
import './less/themes/red.less';
import './less/themes/yellow.less';
10 changes: 5 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlwebpackPlugin = require('html-webpack-plugin');

const { STYLE_DEBUG } = process.env;
// 主题路径
const THEME_PATH = './src/less/themes';

Expand Down Expand Up @@ -41,7 +40,8 @@ module.exports = {
port: 3201
},
entry: {
app: './src/index.js'
app: './src/index.js',
themes: './src/themes.js'
},
output: {
filename: '[name].bundle.js?[hash]',
Expand Down Expand Up @@ -87,8 +87,8 @@ module.exports = {
new HtmlwebpackPlugin({
title: 'webpack 多主题打包演示',
template: 'src/index.html',
inject: true
inject: true,
excludeChunks: ['themes']
})
],
devtool: STYLE_DEBUG === 'SOURCE' && 'source-map'
]
};

0 comments on commit 90c1f24

Please sign in to comment.