diff --git a/.eslintignore b/.eslintignore index 7e4a49c02c..f057d232ec 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,3 @@ -js/vendor/ -js/dist/ public/js/ tmp/ vendor/ diff --git a/bin/internal/check-release-excludes.sh b/bin/internal/check-release-excludes.sh index a979db165f..4a182e635e 100755 --- a/bin/internal/check-release-excludes.sh +++ b/bin/internal/check-release-excludes.sh @@ -52,7 +52,7 @@ validateExtension() { foundFileExt fi ;; - public/js/dist/*) + public/js/*) if [ "${extension}" != "js" ] && [ "${extension}" != "map" ]; then foundFileExt fi diff --git a/docs/faq.rst b/docs/faq.rst index bc2bd8b892..86b9532b6c 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -694,7 +694,7 @@ A list of files and corresponding functionality which degrade gracefully when re * :file:`./setup/` (setup script) * :file:`./examples/` (configuration examples) * :file:`./resources/sql/` (SQL scripts to configure advanced functionalities) -* :file:`./resources/js/src/` (Source files to re-build `./public/js/dist/`) +* :file:`./resources/js/src/` (Source files to re-build `./public/js/`) * :file:`./resources/js/global.d.ts` JS type declaration file * Run `rm -rv vendor/tecnickcom/tcpdf && composer dump-autoload --no-interaction --optimize --dev` (exporting to PDF) * Run `rm -rv vendor/williamdes/mariadb-mysql-kbs && composer dump-autoload --no-interaction --optimize --dev` (external links to MariaDB and MySQL documentations) diff --git a/public/js/dist/.gitignore b/public/js/.gitignore similarity index 100% rename from public/js/dist/.gitignore rename to public/js/.gitignore diff --git a/public/js/vendor/.gitignore b/public/js/vendor/.gitignore deleted file mode 100644 index a68d087bfe..0000000000 --- a/public/js/vendor/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/* -!/.gitignore diff --git a/resources/js/src/gis_data_editor.ts b/resources/js/src/gis_data_editor.ts index 250e1ff416..17a9b68c55 100644 --- a/resources/js/src/gis_data_editor.ts +++ b/resources/js/src/gis_data_editor.ts @@ -255,7 +255,7 @@ function loadJSAndGISEditor (resolve) { let script; script = document.createElement('script'); - script.src = 'js/dist/table/gis_visualization.js'; + script.src = 'js/table/gis_visualization.js'; document.head.appendChild(script); // OpenLayers.js is BIG and takes time. So asynchronous loading would not work. diff --git a/resources/js/src/modules/ajax.ts b/resources/js/src/modules/ajax.ts index d172d2704d..7f7cea1593 100644 --- a/resources/js/src/modules/ajax.ts +++ b/resources/js/src/modules/ajax.ts @@ -785,8 +785,7 @@ const AJAX = { var script = document.createElement('script'); var self = this; - var file = name.indexOf('vendor/') !== -1 ? name : 'dist/' + name; - script.src = 'js/' + file + '?' + 'v=' + encodeURIComponent(CommonParams.get('version')); + script.src = 'js/' + name + '?' + 'v=' + encodeURIComponent(CommonParams.get('version')); script.async = false; script.onload = function () { self.done(name, callback); diff --git a/resources/templates/scripts.twig b/resources/templates/scripts.twig index d3e3fb302b..2f31c19f92 100644 --- a/resources/templates/scripts.twig +++ b/resources/templates/scripts.twig @@ -1,6 +1,6 @@ {% for file in files %} - {% endfor %} diff --git a/resources/templates/setup/base.twig b/resources/templates/setup/base.twig index 88ca4c14a5..7f19bf63f2 100644 --- a/resources/templates/setup/base.twig +++ b/resources/templates/setup/base.twig @@ -11,8 +11,8 @@ - - + + diff --git a/tests/unit/ScriptsTest.php b/tests/unit/ScriptsTest.php index cc462f8c8b..be08d2781d 100644 --- a/tests/unit/ScriptsTest.php +++ b/tests/unit/ScriptsTest.php @@ -51,7 +51,7 @@ class ScriptsTest extends AbstractTestCase $actual = $this->object->getDisplay(); self::assertStringContainsString( - 'src="js/dist/common.js?v=' . rawurlencode(Version::VERSION) . '"', + 'src="js/common.js?v=' . rawurlencode(Version::VERSION) . '"', $actual, ); self::assertStringContainsString( diff --git a/webpack.config.cjs b/webpack.config.cjs index 573cf17668..3b50684a2e 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -79,14 +79,21 @@ module.exports = [ }, output: { filename: '[name].js', - path: publicPath + '/js/dist', + path: publicPath + '/js', }, optimization: { + chunkIds: 'named', + moduleIds: 'named', runtimeChunk: 'single', splitChunks: { - chunks: 'all', - name: 'shared', - minSize: 1, + cacheGroups: { + shared: { + name: 'shared', + chunks: 'all', + minChunks: 2, + minSize: 1, + }, + }, }, }, externals: {