import { AlphaTabWebPackPlugin } from "@coderline/alphatab/webpack"; in a ESM file leads to import errors like:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'D:\Dev\alphaTabSamplesWeb\src\webpack-nextjs\node_modules\webpack\lib\util\identifier' imported from D:\Dev\alphaTabSamplesWeb\src\webpack-nextjs\node_modules\@coderline\alphatab\dist\alphaTab.webpack.mjs
Did you mean to import webpack-nextjs/node_modules/webpack/lib/util/identifier.js?
Is there an existing issue for this?
Current Behavior
import { AlphaTabWebPackPlugin } from "@coderline/alphatab/webpack";
in a ESM file leads to import errors like:This is because for ESM imports in node file extensions are mandatory: https://nodejs.org/api/esm.html#esm_mandatory_file_extensions
But the webpack plugin imports some webpack files directly without extension
Expected Behavior
Imports must work.
Steps To Reproduce
npx create-next-app@latest
import { AlphaTabWebPackPlugin } from "@coderline/alphatab/webpack";
to the next.config.mjsnpm run dev
Link to jsFiddle, CodePen, Project
No response
Found in Version
1.3
Platform
Web
Environment
Anything else?
Adding the
.js
extension to the modules fixes the problem. In CJS files the require without extension works.