Answer the question
In order to leave comments, you need to log in
How to make two builds with and without jquery in webpack?
I need to generate two versions of a script. In one case, I need to make an assembly that includes jquery, in another case, I need jquery to be taken from the site where the script is located.
module.exports = {
context: __dirname + "/web/js/",
entry: {
"full": full,
"light": light
},
output: {
path: __dirname + "/web/js/",
filename: "[name].js"
},
resolve: {
alias: resolves
},
library: 'client',
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
]
};
Answer the question
In order to leave comments, you need to log in
Made as follows:
1. Made jqueryStub
define('jquery', [], function(){
return window.$;
});
module.exports = [
{
...
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
]
},
{
...
plugins: [
new webpack.ProvidePlugin({
$: __dirname + '/web/js/jqueryStub',
jQuery: __dirname + '/web/js/jqueryStub'
})
]
}
];
Maybe this will help https://webpack.github.io/docs/library-and-externa...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question