Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Babel loader #9456

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions buildtools/webpack.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
90 changes: 6 additions & 84 deletions buildtools/webpack.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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'],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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: {
Expand Down
22 changes: 0 additions & 22 deletions buildtools/webpack.config.dll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
25 changes: 0 additions & 25 deletions buildtools/webpack.share.js

This file was deleted.

11 changes: 0 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading