Skip to content

Commit 8f8a2e7

Browse files
authored
fix error cannot find module. (#886)
* ref: external library * ref: rollup browser still need import file url
1 parent 74548c9 commit 8f8a2e7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

rollup.config.browser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default {
1414
// Specify here external modules which you don't want to include in your bundle (for instance: 'lodash', 'moment' etc.)
1515
// https://rollupjs.org/guide/en#external-e-external
1616
external: [
17+
// brain js already uses gpu.js as peer dependencies so it shouldn't be like this
1718
fileURLToPath(
1819
new URL('./node_modules/gpu.js/src/index.js', import.meta.url)
1920
),

rollup.config.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import json from '@rollup/plugin-json';
33
import resolve from '@rollup/plugin-node-resolve';
44
import typescript from '@rollup/plugin-typescript';
55
import * as pkg from './package.json';
6-
import { fileURLToPath } from 'node:url';
6+
// import { fileURLToPath } from 'node:url';
77

88
const extensions = ['.js', '.json', '.node', '.ts'];
99

@@ -13,9 +13,13 @@ export default {
1313
// Specify here external modules which you don't want to include in your bundle (for instance: 'lodash', 'moment' etc.)
1414
// https://rollupjs.org/guide/en#external-e-external
1515
external: [
16-
fileURLToPath(
17-
new URL('./node_modules/gpu.js/src/index.js', import.meta.url)
18-
),
16+
// brain js already uses gpu.js as peer dependencies so it shouldn't be like this
17+
// fileURLToPath(
18+
// new URL('./node_modules/gpu.js/src/index.js', import.meta.url)
19+
// ),
20+
21+
// But this
22+
'gpu.js'
1923
],
2024

2125
plugins: [

0 commit comments

Comments
 (0)