Skip to content

Commit 916c63d

Browse files
commonjs
1 parent b7e45d5 commit 916c63d

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

molstar-extension/esbuild.config.js

+21-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ const
1010

1111
console.log(`${productionMode ? 'production' : 'development'} build`);
1212

13-
const staticFilesPluginOptions = {
13+
const staticLib = {
1414
src: './src',
1515
dest: './lib',
1616
}
1717

18+
const staticLibCJS = {
19+
src: './src',
20+
dest: './lib/commonjs',
21+
}
22+
1823
const buildLib = await esbuild.context({
1924
entryPoints: ['src/**/*.ts'],
2025
bundle: false,
@@ -23,7 +28,18 @@ const buildLib = await esbuild.context({
2328
outdir: './lib',
2429
platform: 'browser',
2530
tsconfig: 'tsconfig.json',
26-
plugins: [copyStaticFiles(staticFilesPluginOptions), dtsPlugin()]
31+
plugins: [copyStaticFiles(staticLib), dtsPlugin()]
32+
})
33+
34+
const buildLibCJS = await esbuild.context({
35+
entryPoints: ['src/**/*.ts'],
36+
bundle: false,
37+
minify: false,
38+
sourcemap: true,
39+
outdir: './lib/commonjs',
40+
platform: 'node',
41+
tsconfig: 'tsconfig.commonjs.json',
42+
plugins: [copyStaticFiles(staticLibCJS), dtsPlugin()]
2743
})
2844

2945
const buildCSS = await esbuild.context({
@@ -76,6 +92,9 @@ if (productionMode) {
7692

7793
await buildLib.rebuild();
7894
buildLib.dispose();
95+
96+
await buildLibCJS.rebuild();
97+
buildLibCJS.dispose();
7998
}
8099
else {
81100

molstar-extension/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

molstar-extension/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "molstar-volseg",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"type": "module",
55
"description": "MolStar extension for visualizing volumetric and segmentation data",
66
"repository": {

molstar-extension/tsconfig.commonjs.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"noUnusedLocals": true,
1111
"strictNullChecks": true,
1212
"strictFunctionTypes": true,
13-
"module": "ESNext",
13+
"module": "CommonJS",
1414
"esModuleInterop": true,
1515
"moduleResolution": "node",
1616
"importHelpers": true,
@@ -19,7 +19,7 @@
1919
"jsx": "react-jsx",
2020
"lib": [ "es2018", "dom", "ES2022.Object" ],
2121
"rootDir": "src",
22-
"outDir": "lib"
22+
"outDir": "lib/commonjs"
2323
},
2424
"include": [ "src/**/*", "src/extensions/volumes-and-segmentations", "src/extensions/meshes", "src/extensions/cvsx-extension" ],
2525
// "exclude": [ "src/servers/**/*", "src/perf-tests/*", "src/cli/**/*" ]

0 commit comments

Comments
 (0)