admin管理员组文章数量:1316339
So I migrated from version 17 to 19, and now the dynamic imports don't work on ng build
.
This import
import('@fingerprintjs/fingerprintjs/dist/fp.esm.js')
results in:
TypeError: Failed to resolve module specifier '@fingerprintjs/fingerprintjs/dist/fp.esm.js'
In version 17, this file was bundled like as fp.esm-Q72BNRQR.js
and dynamic import was rewritten as
import("./fp.esm-Q72BNRQR.js")
So I migrated from version 17 to 19, and now the dynamic imports don't work on ng build
.
This import
import('@fingerprintjs/fingerprintjs/dist/fp.esm.js')
results in:
TypeError: Failed to resolve module specifier '@fingerprintjs/fingerprintjs/dist/fp.esm.js'
In version 17, this file was bundled like as fp.esm-Q72BNRQR.js
and dynamic import was rewritten as
import("./fp.esm-Q72BNRQR.js")
Share
Improve this question
edited Jan 29 at 11:25
DarkBee
15.6k8 gold badges72 silver badges117 bronze badges
asked Jan 29 at 10:37
DesperadoDesperado
2842 silver badges12 bronze badges
1 Answer
Reset to default 0Make sure you have installed the necessary typing for using this library:
npm i --save-dev @types/fingerprintjs__fingerprintjs
You should omit the .esm.js
and just point to the file without the extension, then it works.
The error could be due to some changes in the angular builder (ESBuild) or version update (tsconfig options updated), I am not sure about this.
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
@Component({
selector: 'app-root',
imports: [RouterOutlet],
templateUrl: './appponent.html',
styleUrl: './appponent.scss'
})
export class AppComponent {
title = 'test';
ngOnInit() {
const data = import('@fingerprintjs/fingerprintjs/dist/fp');
console.log(data);
}
}
本文标签: angularFailed to resolve dynamic importStack Overflow
版权声明:本文标题:angular - Failed to resolve dynamic import - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742001811a2411165.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论