Skip to content

Commit

Permalink
chore(feed): 格式化 webpack 配置文件
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Jul 31, 2018
1 parent b3d2125 commit 427543c
Showing 1 changed file with 44 additions and 46 deletions.
90 changes: 44 additions & 46 deletions packages/slimkit-plus-feed/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ const resolve = pathname => path.resolve(src, pathname);
|
*/

const join = pathname => path.join(src, pathname);

const webpackConfig = {

mode: isProd ? 'production' : 'development',
/*
mode: isProd ? 'production' : 'development',
/*
|---------------------------------------------------------
| 开发工具
|---------------------------------------------------------
Expand All @@ -93,9 +91,9 @@ mode: isProd ? 'production' : 'development',
|
*/

devtool: isProd ? false : 'source-map',
devtool: isProd ? false : 'source-map',

/*
/*
|---------------------------------------------------------
| 配置入口
|---------------------------------------------------------
Expand All @@ -104,11 +102,11 @@ devtool: isProd ? false : 'source-map',
|
*/

entry: {
admin: resolve('main.js')
},
entry: {
admin: resolve('main.js')
},

/*
/*
|---------------------------------------------------------
| 输出配置
|---------------------------------------------------------
Expand All @@ -117,12 +115,12 @@ entry: {
|
*/

output: {
path: isRepositorie ? path.join(__dirname, '../../../../public/zhiyicx/plus-component-feed') : path.join(__dirname, 'assets'),
filename: '[name].js'
},
output: {
path: isRepositorie ? path.join(__dirname, '../../../../public/zhiyicx/plus-component-feed') : path.join(__dirname, 'assets'),
filename: '[name].js'
},

/*
/*
|---------------------------------------------------------
| 解决配置
|---------------------------------------------------------
Expand All @@ -131,14 +129,14 @@ output: {
|
*/

resolve: {
resolve: {
// 忽略加载的后缀
extensions: [ '.js', '.jsx', '.json' ],
// 模块所处的目录
modules: [ src, path.resolve(__dirname, 'node_modules') ]
},
extensions: [ '.js', '.jsx', '.json' ],
// 模块所处的目录
modules: [ src, path.resolve(__dirname, 'node_modules') ]
},

/*
/*
|---------------------------------------------------------
| 模块
|---------------------------------------------------------
Expand All @@ -147,18 +145,18 @@ resolve: {
|
*/

module: {
rules: [
module: {
rules: [
// js文件加载规则
{
test: /\.jsx?$/,
include: [ src ],
use: [ 'babel-loader' ]
}
]
},
{
test: /\.jsx?$/,
include: [ src ],
use: [ 'babel-loader' ]
}
]
},

/*
/*
|---------------------------------------------------------
| 插件配置
|---------------------------------------------------------
Expand All @@ -167,24 +165,24 @@ module: {
|
*/

plugins: [
plugins: [
// Defined build env.
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(NODE_ENV)
}
}),
new WebpackLaravelMixManifest(),
...(isProd ? [
// Prod env.
new UglifyJsPlugin({
sourceMap: false
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(NODE_ENV)
}
}),
] : [
new WebpackLaravelMixManifest(),
...(isProd ? [
// Prod env.
new UglifyJsPlugin({
sourceMap: false
}),
] : [
// Development env.
new webpack.NoEmitOnErrorsPlugin(),
])
],
new webpack.NoEmitOnErrorsPlugin(),
])
],

// optimization: {
// splitChunks: {
Expand Down

0 comments on commit 427543c

Please sign in to comment.