Skip to content

Commit f8d9ab1

Browse files
committed
Add dynamic import support.
1 parent 3334f58 commit f8d9ab1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ function mapOptions (opts) {
66
opts = xtend({
77
ecmaVersion: 2019,
88
allowHashBang: true,
9-
allowReturnOutsideFunction: true
9+
allowReturnOutsideFunction: true,
10+
plugins: {
11+
dynamicImport: opts.sourceType === 'module'
12+
}
1013
}, opts)
1114
opts.plugins = xtend(opts.plugins, {})
1215
return opts
@@ -23,3 +26,5 @@ module.exports = exports = xtend(acorn, {
2326
return acorn.tokenizer(src, mapOptions(opts))
2427
}
2528
})
29+
30+
require('acorn-dynamic-import/lib/inject').default(exports)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"dependencies": {
1010
"acorn": "^5.6.2",
11+
"acorn-dynamic-import": "^3.0.0",
1112
"xtend": "^4.0.1"
1213
},
1314
"devDependencies": {

0 commit comments

Comments
 (0)