Skip to content

Commit

Permalink
jquery imported as an extra entry instead of chunk - undefined chunk fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksydan committed Nov 3, 2023
1 parent d506701 commit 26d3627
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions _dev/js/jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'jquery'; // ONLY FOR CHUNK
2 changes: 0 additions & 2 deletions _dev/js/theme.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import 'jquery'; // ONLY FOR CHUNK

import './theme/index';
2 changes: 1 addition & 1 deletion _dev/js/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EventEmitter from 'events';

import './windowExpose';
import './core/index';
import './vendors/bootstrap/bootstrap-imports';
import './vendors/index';
import './components/dynamic-bootstrap-components';
import bsCustomFileInput from 'bs-custom-file-input';
import './components/header/index';
Expand Down
1 change: 1 addition & 0 deletions _dev/js/theme/vendors/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './bootstrap/bootstrap-imports';
6 changes: 0 additions & 6 deletions _dev/webpack/webpack.parts.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@ exports.extractVendorsChunks = () => ({
filename: 'js/swipervendor.js',
chunks: 'initial',
},
jquery: {
test: /[\\/]node_modules[\\/](jquery)[\\/]/,
name: 'jquery',
filename: 'js/jquery.js',
chunks: 'initial',
},
shared: {
name: 'shared',
chunks: 'initial',
Expand Down
1 change: 1 addition & 0 deletions _dev/webpack/webpack.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const plugins = (purge, analyze) => ([
new EsbuildPlugin({
target: 'es2016',
format: 'iife',
minify: true,
}),
analyze ? new BundleAnalyzerPlugin() : false,
purge ? new PurgeCSSPlugin({
Expand Down
2 changes: 2 additions & 0 deletions _dev/webpack/webpack.vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ exports.webpackVars = {
]
}

resultEntries.jquery = path.resolve(themeDev, `./js/jquery.js`);

return resultEntries;
},
getOutput: ({ mode, publicPath, siteURL, port, devServer }) => ({
Expand Down
6 changes: 3 additions & 3 deletions config/assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ js:
runtime: # This file is only used to handle HMR for multiple entry points
fileName: runtime.js
priority: 1
jquery:
fileName: jquery.js
priority: 1
# jquery: # Uncomment this if you want to use jQuery
# fileName: jquery.js
# priority: 1
shared: # Shared code between all pages autogenerated by Webpack
fileName: shared.js
priority: 1
Expand Down

0 comments on commit 26d3627

Please sign in to comment.