Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 306afd6

Browse files
committed
Update extract function due to vuejs/vueify@2fb8281 removing vueify-insert-css
1 parent 9581a4a commit 306afd6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

index.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,29 @@ function cssExtract(bundle, opts) {
3939

4040
function extract(chunk) {
4141

42-
if (chunk.source.indexOf('vueify-insert-css') === -1) return ''
42+
if (chunk.source.indexOf('__vueify_insert__') === -1) return ''
4343

4444
const css = []
4545

4646
const ast = falafel(chunk.source, {
4747
ecmaVersion: 6
4848
}, function(node) {
49-
if (!isRequire(node)) return
5049

51-
if (!node.arguments) return
52-
53-
if (!node.arguments[0]) return
50+
if(node.type !== 'CallExpression') return
5451

55-
if (node.arguments[0].value !== 'vueify-insert-css') return
52+
if(!node.callee.object) return
5653

57-
if (!node.parent.parent.arguments || !node.parent.parent.arguments[0]) return
54+
if(!node.callee.object.name || node.callee.object.name !== '__vueify_insert__') return
55+
56+
if (!node.arguments) return
5857

59-
css.push(node.parent.parent.arguments[0].value)
60-
node.parent.parent.update('0')
58+
if (!node.arguments[0]) return
59+
60+
css.push(node.arguments[0].value)
61+
node.update('0')
6162
});
6263

6364
chunk.source = ast.toString()
6465

6566
return css.join('\n')
66-
}
67+
}

0 commit comments

Comments
 (0)