Closed wintercounter closed 1 year ago
Using require.resolve will fail on ESM packages having no package.json in their exports field (and most of them won't have it).
require.resolve
package.json
exports
https://github.com/JeremyRH/storybook-addon-code-editor/blob/c7aabd3c01000e5a453af7e9eca207eb9d2ab206/getStaticDirs.js#L8
Instead, you can resolve the entry file, and use that path to resolve the package dir.
const entryDir = path.dirname(require.resolve(packageName)) const packageDir= moduleName.replace(new RegExp(`^(.*${packageName})(.*)$`), (_, dir) => dir)
I have this issue use monaco-tailwindcss@0.6.0
monaco-tailwindcss@0.6.0
Using
require.resolve
will fail on ESM packages having nopackage.json
in theirexports
field (and most of them won't have it).https://github.com/JeremyRH/storybook-addon-code-editor/blob/c7aabd3c01000e5a453af7e9eca207eb9d2ab206/getStaticDirs.js#L8
Instead, you can resolve the entry file, and use that path to resolve the package dir.
I have this issue use
monaco-tailwindcss@0.6.0