-
Notifications
You must be signed in to change notification settings - Fork 362
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
Use user's typescript first, fallback to bundled #741
Changes from all commits
f81c3b3
0a0aa0d
aa06df4
82df6ab
32d8056
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'microbundle': minor | ||
--- | ||
|
||
Use user's typescript first, fallback to bundled |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import autoprefixer from 'autoprefixer'; | |
import cssnano from 'cssnano'; | ||
import { rollup, watch } from 'rollup'; | ||
import builtinModules from 'builtin-modules'; | ||
import resolveFrom from 'resolve-from'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this instead of just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not much different in theory. "resolve-from" needs node v8.0 while This PR works with yarn, I'm using yarn actually. But I have no idea about pnpm. BTW there's an issue in "require-resolve" which complained that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Node 8 is EOL so that doesn't matter You're using yarn 2? Then it's fine to merge |
||
import commonjs from '@rollup/plugin-commonjs'; | ||
import babel from '@rollup/plugin-babel'; | ||
import customBabel from './lib/babel-custom'; | ||
|
@@ -486,7 +487,10 @@ function createConfig(options, entry, format, writeMeta) { | |
}, | ||
useTypescript && | ||
typescript({ | ||
typescript: require('typescript'), | ||
typescript: require(resolveFrom.silent( | ||
options.cwd, | ||
'typescript', | ||
) || 'typescript'), | ||
cacheRoot: `./node_modules/.cache/.rts2_cache_${format}`, | ||
useTsconfigDeclarationDir: true, | ||
tsconfigDefaults: { | ||
|
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.
Do you consider this a breaking change?
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.
Used to considered it to be a fix + feature instead of break, and it can fallback to previous behavior.
After thought more carefully... Maybe you're right, in theroy if user previously used different TS version during developing & bundling, it will lead to different result.
But I'm still hesitating. Logically if a user previously:
Anyway, major is always a safer choice... Shall I update the PR?