Skip to content

Commit 78060c0

Browse files
committed
fix(soba): attempt to use commonjs with loadEsmModule
1 parent 2600c9e commit 78060c0

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Diff for: libs/plugin/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "plugin",
3-
"type": "module"
3+
"type": "commonjs"
44
}

Diff for: libs/plugin/src/generators/gltf/generator.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { formatFiles, logger, names, readJson, readProjectConfiguration, Tree, workspaceRoot } from '@nx/devkit';
22
import { prompt } from 'enquirer';
3+
import { loadEsmModule } from 'ng-packagr/lib/utils/load-esm';
34
import { addSobaGenerator } from '../add-soba/generator';
45

56
export interface GltfGeneratorSchema {
@@ -44,7 +45,10 @@ export async function gltfGenerator(tree: Tree, options: GltfGeneratorSchema) {
4445
}
4546

4647
try {
47-
const injectGLTF = await import('angular-three-soba/loaders').then((m) => m.injectGLTF);
48+
const injectGLTF = await loadEsmModule<typeof import('angular-three-soba/loaders')>(
49+
'angular-three-soba/loaders',
50+
).then((m) => m.injectGLTF);
51+
// const injectGLTF = await import('angular-three-soba/loaders').then((m) => m.injectGLTF);
4852

4953
const { gltfPath, project, console: toConsole, modelName, outputPath, draco, meshopt } = normalizeOptions(options);
5054

Diff for: libs/plugin/tsconfig.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"module": "ESNext",
5-
"target": "ESNext",
4+
"module": "commonjs",
65
"verbatimModuleSyntax": false
76
},
87
"files": [],

0 commit comments

Comments
 (0)