我的入口js是这样的
entry: {
login: './app/js/login.js',
index: './src/js/index.js',
jquery:['jquery']//jquery用npm安装的
},
plugins是这样的
new CommonsChunkPlugin({ name: 'common', minChunks: 2 }),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
'window.$': 'jquery'
})
login.js是这样的
import {mod1} from './mod1.js'
console.log(mod1+'loginPage');
$('#login-title').text('logintitle');
index.js是这样的
import {mod1} from './mod1.js'
console.log(mod1+'indexPage');