From 1381a371b1158b2f5d7d36201c6b642ff60cb984 Mon Sep 17 00:00:00 2001 From: "Peter A. Jonsson" Date: Mon, 24 Mar 2025 23:55:52 +0100 Subject: [PATCH] webpack: use terriajs build rule for [tj]s Fixes #730 --- buildprocess/webpack.config.js | 43 +++++++--------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/buildprocess/webpack.config.js b/buildprocess/webpack.config.js index 9d3feeb42..125a797d2 100644 --- a/buildprocess/webpack.config.js +++ b/buildprocess/webpack.config.js @@ -24,39 +24,6 @@ module.exports = function (devMode) { // following rules are for terriamap source files // rules for building terriajs are configured in configureWebpackForTerriaJS rules: [ - // build source files - { - test: /\.(ts|js)x?$/, - include: [ - path.resolve(__dirname, "..", "index.js"), - path.resolve(__dirname, "..", "entry.js"), - path.resolve(__dirname, "..", "plugins.ts"), - path.resolve(__dirname, "..", "lib") - ], - use: [ - { - loader: "babel-loader", - options: { - cacheDirectory: true, - presets: [ - [ - "@babel/preset-env", - { - corejs: 3, - useBuiltIns: "usage" - } - ], - ["@babel/preset-react", { runtime: "automatic" }], - ["@babel/typescript", { allowNamespaces: true }] - ], - plugins: [ - ["@babel/plugin-proposal-decorators", { legacy: true }], - "babel-plugin-styled-components" - ] - } - } - ] - }, // import html file as string { test: /\.html$/, @@ -146,9 +113,17 @@ module.exports = function (devMode) { "../lib/Styles/variables-overrides.scss" ); + const terriaJSBasePath = path.dirname(require.resolve("terriajs/package.json")); + const jsExtraPaths = [ + path.resolve(__dirname, "..", "index.js"), + path.resolve(__dirname, "..", "entry.js"), + path.resolve(__dirname, "..", "plugins.ts"), + path.resolve(__dirname, "..", "lib") + ]; return configureWebpackForPlugins( configureWebpackForTerriaJS({ - terriaJSBasePath: path.dirname(require.resolve("terriajs/package.json")), + terriaJSBasePath, + jsExtraPaths, config, devMode, MiniCssExtractPlugin