File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 44
44
"dependencies" : {
45
45
"@kazupon/vue-i18n-loader" : " ^0.3.0" ,
46
46
"acorn" : " ^6.1.1" ,
47
+ "acorn-dynamic-import" : " ^4.0.0" ,
47
48
"acorn-walk" : " ^6.1.1" ,
48
49
"cookie" : " ^0.4.0" ,
49
50
"js-cookie" : " ^2.2.0" ,
Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ const { readFileSync } = require('fs')
2
2
const { COMPONENT_OPTIONS_KEY } = require ( './constants' )
3
3
4
4
const acorn = require ( 'acorn' )
5
- const walker = require ( 'acorn-walk' )
5
+ const dynamicImport = require ( 'acorn-dynamic-import' )
6
+ const inject = require ( 'acorn-dynamic-import/lib/walk' )
7
+ const walker = inject . default ( require ( 'acorn-walk' ) )
6
8
// Must not be an explicit dependency to avoid version mismatch issue.
7
9
// See https://github.com/nuxt-community/nuxt-i18n/issues/297
8
10
const compiler = require ( 'vue-template-compiler' )
@@ -15,7 +17,7 @@ exports.extractComponentOptions = (path) => {
15
17
}
16
18
17
19
const script = Component . script . content
18
- const parsed = acorn . parse ( script , {
20
+ const parsed = acorn . Parser . extend ( dynamicImport . default ) . parse ( script , {
19
21
ecmaVersion : 10 ,
20
22
sourceType : 'module'
21
23
} )
@@ -26,7 +28,7 @@ exports.extractComponentOptions = (path) => {
26
28
componentOptions = eval ( `({${ data } })` ) [ COMPONENT_OPTIONS_KEY ] // eslint-disable-line
27
29
}
28
30
}
29
- } )
31
+ } , walker . base )
30
32
31
33
return componentOptions
32
34
}
You can’t perform that action at this time.
0 commit comments