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);
}
}