优化前耗时
webpack.config.js
const config = {
entry: './src/index.js',
output: {
filename: 'main.js'
},
mode: 'development',
module: {
noParse: (path) => {
console.log('结果', /jquery|lodash\//.test(path))
return /jquery|lodash\//.test(path)
},
}
}
module.exports = config;
npm i jquery
src/index.js
import $ from 'jquery'
$(document).ready(() => {
$('body').css({
width: '100%',
height: '100%',
'background-color': 'red'
})
})
优化后耗时