Skip to content

Commit

Permalink
Use selectLoaderPlugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Jul 29, 2023
1 parent 1f3e318 commit b051e96
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 158 deletions.
15 changes: 14 additions & 1 deletion buildprocess/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const babelPlugin = require("./babelPlugin");
const transformJsxControlStatements = require("./babelPluginTransformJsxControlStatements");
const path = require("path");
const svgr = require("esbuild-plugin-svgr");
const selectLoaderPlugin = require("terriajs/buildprocess/selectLoaderPlugin");

const includePaths = [
// Support resolving paths like "terriajs/..."
Expand All @@ -20,7 +21,7 @@ esbuild
entryPoints: ["index.js"],
bundle: true,
outfile: "wwwroot/esbuild/TerriaMap.js",
publicPath: "/build-just-terriajs/esbuild",
publicPath: "/esbuild",
jsx: "transform",
define: {
"process.env.NODE_ENV":
Expand All @@ -31,6 +32,18 @@ esbuild
sourcemap: true,
target: "es2019",
plugins: [
selectLoaderPlugin({
loaders: [
{
filter: /^raw-loader!(.*)$/,
loader: "text"
},
{
filter: /^file-loader!(.*)$/,
loader: "file"
}
]
}),
terriaSassModulesPlugin({ includePaths }),
svgr({
plugins: ["@svgr/plugin-jsx"],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/eslint-parser": "^7.12.16",
"@babel/plugin-proposal-class-properties": "^7.16.0",
"@babel/plugin-transform-class-properties": "^7.16.0",
"@babel/preset-env": "^7.10.4",
"@babel/preset-react": "^7.0.0",
"@csstools/postcss-sass": "^5.0.1",
Expand Down Expand Up @@ -92,7 +92,7 @@
"semver": "^5.0.0",
"style-loader": "^0.23.1",
"svg-sprite-loader": "4.1.3",
"terriajs": "../terriajs",
"terriajs": "8.2.29",
"ts-loader": "^5.3.3",
"typescript": "^4.9.5",
"urijs": "^1.18.12",
Expand Down
7 changes: 7 additions & 0 deletions plugins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { TerriaPluginModule } from "terriajs-plugin-api";

if (
!new (class {
x;
})().hasOwnProperty("x")
)
throw new Error("Transpiler is not configured correctly");

/**
* A function that when called imports all plugins.
*/
Expand Down
Loading

0 comments on commit b051e96

Please sign in to comment.