File tree 3 files changed +24
-1
lines changed
3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 98
98
"resolve-from" : " ^5.0.0" ,
99
99
"rollup-plugin-typescript2" : " ^0.19.2" ,
100
100
"semantic-release" : " ^15.13.3" ,
101
+ "semver" : " ^7.3.2" ,
101
102
"slash" : " ^2.0.0" ,
102
103
"string-width" : " ^3.0.0" ,
103
104
"stringify-author" : " ^0.1.3" ,
Original file line number Diff line number Diff line change @@ -177,6 +177,23 @@ export class Bundler {
177
177
rollupFormat === 'iife' ||
178
178
config . bundleNodeModules
179
179
180
+ // rollup-plugin-typescript2 < v0.26 needs the `objectHashIgnoreUnknownHack`
181
+ // option to be enabled to correctly handle async plugins, but it's no
182
+ // longer needed (and causes a warning) if the user has a more recent
183
+ // version installed. [1] if the plugin is installed, detect the version
184
+ // and enable/disable the option accordingly.
185
+ //
186
+ // [1] https://github.com/egoist/bili/issues/305
187
+ const getObjectHashIgnoreUnknownHack = ( ) : boolean => {
188
+ try {
189
+ const { version } = this . localRequire ( 'rollup-plugin-typescript2/package.json' )
190
+ const semver = require ( 'semver' )
191
+ return semver . lt ( version , '0.26.0' )
192
+ } catch ( e ) {
193
+ return true
194
+ }
195
+ }
196
+
180
197
const pluginsOptions : { [ key : string ] : any } = {
181
198
progress :
182
199
config . plugins . progress !== false &&
@@ -227,7 +244,7 @@ export class Bundler {
227
244
( source . hasTs || config . plugins . typescript2 ) &&
228
245
merge (
229
246
{
230
- objectHashIgnoreUnknownHack : true ,
247
+ objectHashIgnoreUnknownHack : getObjectHashIgnoreUnknownHack ( ) ,
231
248
tsconfigOverride : {
232
249
compilerOptions : {
233
250
module : 'esnext'
Original file line number Diff line number Diff line change @@ -8437,6 +8437,11 @@ semver@7.0.0:
8437
8437
resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
8438
8438
integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==
8439
8439
8440
+ semver@^7.3.2 :
8441
+ version "7.3.2"
8442
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
8443
+ integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
8444
+
8440
8445
semver@~5.3.0 :
8441
8446
version "5.3.0"
8442
8447
resolved "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
You can’t perform that action at this time.
1 commit comments
vercel[bot] commentedon Apr 28, 2020
Successfully deployed to following URLs: