-
-
Save BTMPL/3162cb5c527980e2f68bedd8a18da03f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require("path"); | |
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
const ETP = new ExtractTextPlugin({ | |
allChunks: true | |
}); | |
module.exports = [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: [{ | |
loader: "babel-loader" | |
}] | |
}, | |
{ | |
test: /\.css$/, | |
use: [ { loader: 'style-loader' }, { loader: 'css-loader' } ] | |
}, | |
{ | |
test: /\.less$/, | |
use: ((env) => { | |
if(env == 'production') { | |
return ETP.extract({ | |
use: [{ | |
loader:'css-loader', | |
options: { | |
modules: true, | |
localIdentName: '[local]--[hash:base64:5]', | |
} | |
}, { | |
loader:'less-loader' | |
}] | |
}); | |
} | |
else { | |
return [{ | |
loader: 'style-loader' | |
}, { | |
loader:'css-loader', | |
options: { | |
modules: true, | |
localIdentName: '[local]--[hash:base64:5]', | |
} | |
}, { | |
loader:'less-loader' | |
} | |
]; | |
} | |
})(process.env.NODE_ENV) | |
}, | |
{ | |
test: /\.(ttf|woff|jpeg|jpg|png|gif|svg|woff2|eot)$/, | |
use: [ | |
{ | |
loader: "file-loader", | |
options: { | |
outputPath: path.join("assets", "/"), | |
name: '[name]--[hash:base64:5].[ext]' | |
} | |
} | |
] | |
} | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment