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
support newer moduleResolution
kinds, update build to TS 5.x
#453
Conversation
module: 'ES2022'
, update moduleResolution
default to node16
module: 'ES2022'
, update moduleResolution
default to node16
module: 'ES2022'
, update moduleResolution
default to node16
, update to to TS 5.x
module: 'ES2022'
, update moduleResolution
default to node16
, update to to TS 5.xmodule: 'ES2022'
, update moduleResolution
default to node16
, update build to TS 5.x
module: 'ES2022'
, update moduleResolution
default to node16
, update build to TS 5.xmoduleResolution
default to node16
, update build to TS 5.x
moduleResolution
default to node16
, update build to TS 5.xmoduleResolution
overrides, update build to TS 5.x
moduleResolution
overrides, update build to TS 5.xmoduleResolution
overrides, update build to TS 5.x
moduleResolution
overrides, update build to TS 5.xmoduleResolution
kinds, update build to TS 5.x
src/get-options-overrides.ts
Outdated
case tsModule.ModuleResolutionKind.Bundler: | ||
default: | ||
overrides.moduleResolution = tsModule.ModuleResolutionKind.Node10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna need to review this in a lot more detail (need to catch up on TS changes since 5.x hit GA and refresh myself on this codebase), but I mentioned mjs
support and bundler
in #434 (comment).
bundler
actually seemed the most appropriate at the time (since Rollup is a bundler) for Node16
+, particularly due to the file extension issues. That's actually why I didn't implement support for mjs
/ cjs
earlier because the file extension requirement could break many things (that and no user requested it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this basically lowest effort to let users use more moduleResolution values without figuring out exactly what the differences are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think bundler
should not be overwritten either. With that change and README modifications about this, I think we could approve and merge this in.
Without tests though, we won't be able to confirm some of the behavior of node16
/ nodeNext
(particularly around file extensions) -- it is possible we may need to override those two to bundler
as well
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly LGTM now, just left a tiny comment style comment. we'll ofc iterate on the docs as we test more and get feedback
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Hey team! Thanks for this. Wondering when it might get released / published to npm? |
@tcschiller could you test to see if this PR works for your use-case? |
Pulled down latest from the
Then I tried my own repo, first, without that tarball. Built my library and successfully reproduced the problem at hand - it can't resolve imports with relative paths (e.g., Then I ran in my own repo:
And immediately retried the build which, up to this point, was failing. Could no longer reproduce the problem; it seems the MR discussed here fixes everything (because my TypeScript config has the Thanks for the hard work, @ezolenko . Hope the above proves helpful! |
Thanks for testing this out @tcschiller! For reference, you can reference a GH repo directly in NPM (and any |
I was also curious about I approved a few months ago since this is still better than the previous state, but that was the one remaining question on this PR |
Well, shouldn't break anything. I'll release this sometime tomorrow. |
In 0.36.0 now |
@ezolenko with 0.36.0 I'm getting the following error:
With the following tsconfig settings: {
"compilerOptions": {
"module": "Node16",
"moduleResolution": "Node16",
// ...
}
} And the following Rollup plugin config settings: const fileExtensions = ['.mjs', '.cjs', '.js', '.ts', '.json'];
const plugins = [
json(),
commonjs(),
peerDepsExternal({
packageJsonPath: path.join(dir, 'package.json'),
}),
nodeResolve({
extensions: fileExtensions,
preferBuiltins: true,
exportConditions: ['node'],
mainFields: ['module', 'main'], // This instructs Rollup to prioritize ESM over CJS when resolving modules
modulesOnly: true,
}),
typescript({
check: true,
tsconfig: path.join(dir, 'tsconfig.lib.json'),
useTsconfigDeclarationDir: true,
}),
del({ targets: `${dir}/dist/*` }),
]; I'm using the package following versions:
As far as I can see, this comes from these lines: https://github.com/ezolenko/rollup-plugin-typescript2/blob/0.36.0/src/parse-tsconfig.ts#L46-L48 |
@PetarKirov this PR only changed the There are potentially additional changes needed for the If you need |
This doesn't work with either |
Summary
Fixes #437
Details