Skip to content

Commit e0d3cac

Browse files
terapyonterapyon
authored andcommitted
fix js build error
1 parent ae3f539 commit e0d3cac

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ node_modules
22
dist
33
coverage
44
**/*.d.ts
5-
tests
5+
tests
6+
# Auto-generated bundle content (see scripts/generate-bundle-module.js)
7+
src/standaloneBundleContent.ts

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"scripts": {
3232
"build": "yarn run build:standalone && yarn run build:lib && yarn run build:labextension:dev",
3333
"build:prod": "yarn run build:standalone && yarn run build:lib && yarn run build:labextension",
34-
"build:standalone": "webpack --config webpack.standalone.js && node scripts/generate-bundle-module.js",
34+
"build:standalone": "node scripts/generate-bundle-module.js --stub && webpack --config webpack.standalone.js && node scripts/generate-bundle-module.js",
3535
"build:labextension": "jupyter labextension build .",
3636
"build:labextension:dev": "jupyter labextension build --development True .",
3737
"build:lib": "tsc",

scripts/generate-bundle-module.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
* This script reads the built netvis-standalone.min.js and generates
66
* a TypeScript file that exports the bundle content as a string constant.
77
*
8-
* Usage: node scripts/generate-bundle-module.js
8+
* Usage:
9+
* node scripts/generate-bundle-module.js # Generate from built bundle
10+
* node scripts/generate-bundle-module.js --stub # Create placeholder stub
911
*
1012
* Output: src/standaloneBundleContent.ts
1113
*/
@@ -22,6 +24,24 @@ const bundlePath = path.join(
2224
);
2325
const outputPath = path.join(__dirname, '..', 'src', 'standaloneBundleContent.ts');
2426

27+
// Check if we should create a stub (placeholder)
28+
const isStub = process.argv.includes('--stub');
29+
30+
if (isStub) {
31+
// Create a placeholder that allows TypeScript to compile
32+
const stubContent = `/**
33+
* Auto-generated stub file - will be replaced with actual bundle content.
34+
* DO NOT EDIT MANUALLY - regenerate with: node scripts/generate-bundle-module.js
35+
*/
36+
37+
// Placeholder - will be replaced after webpack build
38+
export const STANDALONE_BUNDLE: string = '';
39+
`;
40+
fs.writeFileSync(outputPath, stubContent, 'utf8');
41+
console.log(`Created stub: ${outputPath}`);
42+
process.exit(0);
43+
}
44+
2545
// Read the bundle
2646
if (!fs.existsSync(bundlePath)) {
2747
console.error(`Error: Bundle not found at ${bundlePath}`);

0 commit comments

Comments
 (0)