-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MJS wrappers of ./cjs/subdir/*.js are incorrectly created at ./cjs/*-wrapper.mjs #253
Comments
I tried a quick and easy fix. It didn't work. Instead of changing the pattern for the InputMap keys, the path of an MJS wrapper should not be affected by the Input Map key at all and should be created alongside the CJS output. packemon/packages/packemon/src/schemas.ts Line 89 in a443f15
.keysOf(string().match(/^[/a-zA-Z0-9-_]+$/u)),
^ This change causes the wrapper files to be created in the correct directory, but their import will now add the directories in the InputMap key to the import path, thereby breaking the import path again. Before this change: // ./cjs/dotnetHelpers-wrapper.mjs
// Bundled with Packemon: https://packemon.dev
// This is an MJS wrapper for a sibling CJS file
// should be './dotnet/dotnetHelpers.cjs'
import data from './dotnetHelpers.cjs';
export const { configureDotnetNugetPush, configurePrepareCmd, nugetDefault } = data; After this change and InputMap key prefixed with // ./cjs/dotnet/dotnetHelpers-wrapper.mjs
// Bundled with Packemon: https://packemon.dev
// This is an MJS wrapper for a sibling CJS file
// should be './dotnetHelpers.cjs'
import data from './dotnet/dotnetHelpers.cjs';
export const { configureDotnetNugetPush, configurePrepareCmd, nugetDefault } = data; |
Whats your |
Just saw this...five months later. This is the the configuration for my CJS releases. And the configs for my w.i.p. MJS branches which do not have this issue. I decided to stop targeting CJS for multiple reasons. One reason was this issue, but another was because Semantic Release had finally fully migrated to MJS. |
The wrappers then try and fail to import their CJS module from './*.cjs'
The path of the wrappers depend on their CJS module's InputMap key.
Additionally...
The pattern for an InputMap key prohibits '/' characters.
Removing the '/' characters from the keys causes the "-wrapper.m,js" files to be created at
./cjs/*-wrapper.mjs
instead of alongside the CJS files at./cjs/dotnet/*.cjs
This doesn't work. The wrappers' import statements treat the CJS modules as if they're in the same directory and will fail to load them.
The text was updated successfully, but these errors were encountered: