diff --git a/buildtools/webpack.api.js b/buildtools/webpack.api.js index 171ea08d79aa..fc1f0cc20430 100644 --- a/buildtools/webpack.api.js +++ b/buildtools/webpack.api.js @@ -30,28 +30,6 @@ module.exports = (env, argv) => { return { entry: './api/index.js', devtool: 'source-map', - module: { - rules: [ - { - test: /\.js$/, - use: { - loader: 'babel-loader', - options: { - babelrc: false, - comments: false, - presets: [ - [ - '@babel/preset-env', - { - targets: require('./webpack.share').browsers, - }, - ], - ], - }, - }, - }, - ], - }, output: { filename: 'api.js', path: dest, diff --git a/buildtools/webpack.commons.js b/buildtools/webpack.commons.js index 3a6bfbaaddff..30ad6e7a0b57 100644 --- a/buildtools/webpack.commons.js +++ b/buildtools/webpack.commons.js @@ -49,15 +49,6 @@ module.exports = function (config) { $: 'jquery', }); - const babelPresetEnv = [ - require.resolve('@babel/preset-env'), - { - targets: config.browsers || require('./webpack.share').browsers, - debug: true, - loose: true, - }, - ]; - // Expose corejs-typeahead as window.Bloodhound const typeaheadRule = { test: require.resolve('corejs-typeahead'), @@ -92,6 +83,11 @@ module.exports = function (config) { }, }; + const tsRule = { + test: /\.tsx?$/, + use: 'ts-loader', + }; + const cssRule = { test: /\.css$/, use: ['./buildtools/webpack.scss-loader', 'extract-loader', 'css-loader'], @@ -142,71 +138,7 @@ module.exports = function (config) { }; } - // Collect every ts(x) files. - const tsRule = { - test: /\.tsx?$/, - use: { - loader: 'babel-loader', - options: { - babelrc: false, - comments: false, - assumptions: { - setPublicClassFields: true, - }, - presets: [babelPresetEnv], - plugins: [ - [ - require.resolve('@babel/plugin-transform-typescript'), - // TODO remove allowDeclareFields with Babel 8 - {allowDeclareFields: true}, - ], - [require.resolve('@babel/plugin-proposal-decorators'), {decoratorsBeforeExport: true}], - ], - }, - }, - }; - const files = {}; - const ngeoRule = { - // Collect every .js file in ngeo/src/, ngeo/api/ and ngeo/contrib/. - test: (file) => { - const result = /\/(ngeo)\/(src|api|contribs)\/.*\.js$/.test(file); - files[file] = files[file] || {}; - files[file]['ngeo'] = result; - return result; - }, - use: { - loader: 'babel-loader', - options: { - babelrc: false, - comments: false, - presets: [babelPresetEnv], - }, - }, - }; - const otherRule = { - // Collect every .js file in the node_modules folder except ones that the folder's name - // starts with "angular" or "mapillary". - test: (file) => { - const js = file.endsWith('.js'); - const nodeModules = file.includes('/node_modules/'); - const ngeo = file.includes('/node_modules/ngeo'); - const angular = file.includes('/node_modules/angular/'); - const mapillary = file.includes('/node_modules/mapillary-js/'); - const result = js && nodeModules && !ngeo && !angular && !mapillary; - files[file] = files[file] || {}; - files[file]['other'] = result; - return result; - }, - use: { - loader: 'babel-loader', - options: { - babelrc: false, - comments: false, - presets: [babelPresetEnv], - }, - }, - }; const plugins = [ providePlugin, @@ -296,17 +228,7 @@ module.exports = function (config) { path: path.resolve(__dirname, '../dist/'), }, module: { - rules: [ - typeaheadRule, - jqueryRule, - gmfapiExpose, - cssRule, - sassRule, - htmlRule, - tsRule, - ngeoRule, - otherRule, - ], + rules: [typeaheadRule, jqueryRule, gmfapiExpose, cssRule, sassRule, htmlRule, tsRule], }, plugins: plugins, resolve: { diff --git a/buildtools/webpack.config.dll.js b/buildtools/webpack.config.dll.js index 9d6357857a83..c8405eb79227 100644 --- a/buildtools/webpack.config.dll.js +++ b/buildtools/webpack.config.dll.js @@ -32,28 +32,6 @@ module.exports = { filename: '[name].js', library: '[name]', }, - module: { - rules: [ - { - test: /.*\.js$/, - use: { - loader: 'babel-loader', - options: { - babelrc: false, - comments: false, - presets: [ - [ - require.resolve('@babel/preset-env'), - { - targets: require('./webpack.share').browsers, - }, - ], - ], - }, - }, - }, - ], - }, plugins: [ new webpack.DllPlugin({ path: path.resolve(__dirname, '../dist/vendor-manifest.json'), diff --git a/buildtools/webpack.share.js b/buildtools/webpack.share.js deleted file mode 100644 index 1229401d40cd..000000000000 --- a/buildtools/webpack.share.js +++ /dev/null @@ -1,25 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2018-2024 Camptocamp SA -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -module.exports = { - // see: npx browserslist '> 0.7% in CH or > 0.7% in FR or Firefox ESR' - browsers: 'defaults, > 0.1% in CH, > 0.1% in FR, Firefox ESR and supports es6-class and not iOS < 10', -}; diff --git a/package.json b/package.json index a5d4a12c308f..319a65f3fd70 100644 --- a/package.json +++ b/package.json @@ -57,16 +57,6 @@ "typeahead": "corejs-typeahead" }, "devDependencies": { - "@babel/core": "7.25.2", - "@babel/plugin-proposal-class-properties": "7.18.6", - "@babel/plugin-proposal-decorators": "7.24.7", - "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6", - "@babel/plugin-proposal-optional-chaining": "7.21.0", - "@babel/plugin-syntax-object-rest-spread": "7.8.3", - "@babel/plugin-transform-spread": "7.24.7", - "@babel/plugin-transform-typescript": "7.25.2", - "@babel/preset-env": "7.25.3", - "@babel/preset-typescript": "7.24.7", "@eslint/eslintrc": "3.1.0", "@eslint/js": "9.9.1", "@fortawesome/fontawesome-free": "5.15.4", @@ -114,7 +104,6 @@ "angular-touch": "1.8.3", "angular-ui-date": "1.1.1", "angular-ui-slider": "0.4.0", - "babel-loader": "8.3.0", "bootstrap": "4.6.2", "cheerio": "1.0.0-rc.12", "chokidar": "3.6.0",