File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,13 @@ module.exports = {
77
77
}
78
78
} ,
79
79
overrides : [
80
+ {
81
+ // Allow to use `dynamic` import
82
+ files : [ "bin/**/*.js" ] ,
83
+ parserOptions : {
84
+ ecmaVersion : 2020
85
+ }
86
+ } ,
80
87
{
81
88
files : [ "lib/**/*.runtime.js" , "hot/*.js" ] ,
82
89
env : {
Original file line number Diff line number Diff line change @@ -78,8 +78,19 @@ const runCli = cli => {
78
78
const pkgPath = require . resolve ( `${ cli . package } /package.json` ) ;
79
79
// eslint-disable-next-line node/no-missing-require
80
80
const pkg = require ( pkgPath ) ;
81
- // eslint-disable-next-line node/no-missing-require
82
- require ( path . resolve ( path . dirname ( pkgPath ) , pkg . bin [ cli . binName ] ) ) ;
81
+
82
+ if ( pkg . type === "module" || / \. m j s / i. test ( pkg . bin [ cli . binName ] ) ) {
83
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
84
+ import ( path . resolve ( path . dirname ( pkgPath ) , pkg . bin [ cli . binName ] ) ) . catch (
85
+ error => {
86
+ console . error ( error ) ;
87
+ process . exitCode = 1 ;
88
+ }
89
+ ) ;
90
+ } else {
91
+ // eslint-disable-next-line node/no-missing-require
92
+ require ( path . resolve ( path . dirname ( pkgPath ) , pkg . bin [ cli . binName ] ) ) ;
93
+ }
83
94
} ;
84
95
85
96
/**
You can’t perform that action at this time.
0 commit comments