Skip to content

Commit

Permalink
Remove Babel loader
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 29, 2024
1 parent 8a91bb7 commit 1f5790f
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 164 deletions.
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
85 changes: 1 addition & 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 @@ -142,71 +133,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 +223,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],
},
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

0 comments on commit 1f5790f

Please sign in to comment.