Webpack 使css加载程序类名散列作为字符串用于html
在我的JS文件中有一些HTML块作为字符串。例如:Webpack 使css加载程序类名散列作为字符串用于html,webpack,obfuscation,css-loader,Webpack,Obfuscation,Css Loader,在我的JS文件中有一些HTML块作为字符串。例如: `<span class="${currentIndex === index ? 'right' : ''} ${get(item, 'observed') === true ? 'observed' : ''}" data-index="${index}" data-item-id="${get(item, 'id')}"> <b style=
`<span class="${currentIndex === index ? 'right' : ''} ${get(item, 'observed') === true ? 'observed' : ''}"
data-index="${index}" data-item-id="${get(item, 'id')}">
<b style="animation-duration:${get(item, 'length') === '' ? '200' : get(item, 'length')}s"></b>
</span>`
module: {
rules: [
//scss
{
test: /\.scss$/i,
use: [
{
loader: "style-loader"
},
{
loader: 'css-loader',
options: {
// modules: true,
// sourceMap: true,
// importLoaders: 1,
}
},
{
loader: 'sass-loader',
options: {
modules: true
}
},
]
},
//js
{
test: /\.js$/i, exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', {
'targets': {'browsers': ['ie 6', 'safari 7']},
"corejs": 3, // default would be 2
'useBuiltIns': "usage"
}]],
plugins: ["@babel/plugin-proposal-class-properties"]
}
}
}
]
}