@@ -43,10 +43,15 @@ function injectRender (script, render, lang, options) {
43
43
if ( [ 'js' , 'babel' ] . indexOf ( lang . toLowerCase ( ) ) > - 1 ) {
44
44
const matches = / ( e x p o r t d e f a u l t [ ^ { ] * \{ ) / g. exec ( script )
45
45
if ( matches ) {
46
- const renderScript = transpileVueTemplate ( 'module.exports={' +
46
+ let renderScript = 'module.exports={' +
47
47
`render: ${ wrapRenderFunction ( render . render ) } ,` +
48
48
'staticRenderFns: [' +
49
- `${ render . staticRenderFns . map ( wrapRenderFunction ) . join ( ',' ) } ],}` , options . vue )
49
+ `${ render . staticRenderFns . map ( wrapRenderFunction ) . join ( ',' ) } ],}`
50
+
51
+ if ( options . stripWith !== false ) {
52
+ renderScript = transpileVueTemplate ( renderScript , options . vue )
53
+ }
54
+
50
55
const result = script . split ( matches [ 1 ] )
51
56
. join ( renderScript . replace ( 'module.exports={' , 'export default {' ) . replace ( / \} $ / , '' ) )
52
57
@@ -168,6 +173,13 @@ export default function vueTransform (code, id, options) {
168
173
const js = processScript ( nodes . script [ 0 ] , id , code , options , nodes )
169
174
const css = processStyle ( nodes . style , id , code , options , nodes )
170
175
176
+ const isProduction = process . env . NODE_ENV === 'production'
177
+ const isWithStripped = options . stripWith !== false
178
+
179
+ if ( ! isProduction && ! isWithStripped ) {
180
+ js . code = js . code + '\nmodule.exports.render._withStripped = true'
181
+ }
182
+
171
183
if ( options . styleToImports === true ) {
172
184
const style = css . map ( ( s , i ) => 'import ' + JSON . stringify ( `${ id } .${ i } .vue.component.${ s . lang } ` ) + ';' ) . join ( ' ' )
173
185
0 commit comments