0
我目前的配置分別捆綁了Javascript和CSS。但是,我有特定的樣式和JS,它們只與我的網站上的管理儀表板相關,我不希望它們包含在styles.css
樣式表中。Webpack - 用於管理儀表板的獨立CSS/JS軟件包
可以做到這一點嗎?
這裏是我當前的WebPack配置:
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: './lib/js/entry.js',
output: {
path: path.resolve(__dirname, 'public'),
filename: 'main.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: 'babel-loader'
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: [
'css-loader?importLoaders=1',
'postcss-loader'
]
})
},
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }
]
},
plugins: [
new ExtractTextPlugin("styles.css")
]
}