Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module.exports = {
'react-native': 'react-native-web'
}
},

module: {
// First, run the linter.
// It's important to do this before Babel processes the JS.
Expand Down Expand Up @@ -116,6 +116,7 @@ module.exports = {
/\.html$/,
/\.(js|jsx)$/,
/\.css$/,
/\.less$/,
/\.json$/,
/\.svg$/
],
Expand All @@ -130,7 +131,11 @@ module.exports = {
test: /\.(js|jsx)$/,
include: paths.appSrc,
loader: 'babel',

query: {
plugins: [
['import', [{ libraryName: "antd", style: true }]], // 加载 less 文件
]
}
},
// The notation here is somewhat confusing.
// "postcss" loader applies autoprefixer to our CSS.
Expand All @@ -149,6 +154,14 @@ module.exports = {
loader: ExtractTextPlugin.extract('style', 'css?importLoaders=1!postcss')
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract(
'css?sourceMap&!' +
'postcss!' +
'less-loader?{"sourceMap":true,"modifyVars":{"@primary-color":"#1DA57A"}}'
),
},
// JSON is not enabled by default in Webpack but both Node and Browserify
// allow it implicitly so we also enable it.
{
Expand All @@ -165,7 +178,7 @@ module.exports = {
}
]
},

// We use PostCSS for autoprefixing only.
postcss: function() {
return [
Expand Down