Include Webpack and use it for jQuery, Bootstrap and chosen.js
This commit is contained in:
30
config/webpack/environment.js
Normal file
30
config/webpack/environment.js
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
./config/webpack/environment.js
|
||||
Info for this file can be found
|
||||
github.com/rails/webpacker/blob/master/docs/webpack.md
|
||||
*/
|
||||
|
||||
const { environment } = require('@rails/webpacker');
|
||||
const merge = require('webpack-merge');
|
||||
const webpack = require('webpack');
|
||||
|
||||
// Add an additional plugin of your choosing : ProvidePlugin
|
||||
environment.plugins.prepend('Provide', new webpack.ProvidePlugin({
|
||||
$: 'jquery',
|
||||
JQuery: 'jquery',
|
||||
jquery: 'jquery',
|
||||
'window.Tether': "tether",
|
||||
Popper: ['popper.js', 'default'], // for Bootstrap 4
|
||||
})
|
||||
);
|
||||
|
||||
const envConfig = module.exports = environment;
|
||||
const aliasConfig = module.exports = {
|
||||
resolve: {
|
||||
alias: {
|
||||
jquery: 'jquery/src/jquery'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = merge(envConfig.toWebpackConfig(), aliasConfig);
|
Reference in New Issue
Block a user