File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
packages/vue-component/plugin Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 11<p align =" center " ><img src =" https://github.com/Akryum/vue-meteor/raw/master/vue%2Bmeteor.png " ></p >
22
33<p align =" center " >
4- <a href =" https://meteor.com/ " ><img src =" https://img.shields.io/badge/meteor-1.4.4.1 -blue.svg " /></a >
5- <a href =" https://vuejs.org/ " ><img src =" https://img.shields.io/badge/vue-1.x-green.svg " /> <img src =" https://img.shields.io/badge/vue-2.3.3 -brightgreen.svg " /></a >
4+ <a href =" https://meteor.com/ " ><img src =" https://img.shields.io/badge/meteor-1.5 -blue.svg " /></a >
5+ <a href =" https://vuejs.org/ " ><img src =" https://img.shields.io/badge/vue-1.x-green.svg " /> <img src =" https://img.shields.io/badge/vue-2.3.4 -brightgreen.svg " /></a >
66</p >
77
88<br />
Original file line number Diff line number Diff line change @@ -154,6 +154,8 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
154154 // Lazy load files from NPM packages or imports directories
155155 const isLazy = ! ! inputFilePath . match ( / ( ^ | \/ ) ( n o d e _ m o d u l e s | i m p o r t s ) \/ / ) ;
156156
157+ const lazyCSS = ! isDev && isLazy && inputFile . getArch ( ) . indexOf ( 'web' ) !== - 1
158+
157159 // Style
158160 let css = '' ;
159161 let cssHash = '' ;
@@ -165,11 +167,11 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
165167 cssHash = Hash ( css ) ;
166168
167169 //console.log(`css hash: ${cssHash}`);
168- if ( ! isDev && isLazy ) {
170+ if ( lazyCSS ) {
169171 // Wrap CSS in Meteor's lazy CSS loader
170- css = `
171- const modules = require('meteor/modules');
172- modules.addStyles(${ JSON . stringify ( css ) } );
172+ css = `\n
173+ const modules = require('meteor/modules');\n
174+ modules.addStyles(${ JSON . stringify ( css ) } );\n
173175 ` ;
174176 }
175177 }
@@ -181,16 +183,16 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
181183 if ( inputFile . getArch ( ) . indexOf ( 'os' ) === 0 && inputFilePath . indexOf ( 'node_modules' ) !== - 1 ) {
182184 outputFilePath += '.js' ;
183185 }
184-
185- // Including the source maps for .vue files from node_modules breaks source mapping.
186+
187+ // Including the source maps for .vue files from node_modules breaks source mapping.
186188 const sourceMap = inputFilePath . indexOf ( 'node_modules' ) === - 1
187189 ? compileResult . map
188190 : undefined ;
189191
190192 // Add JS Source file
191193 inputFile . addJavaScript ( {
192194 path : outputFilePath ,
193- data : isLazy && ! isDev ? css + js : js ,
195+ data : lazyCSS ? css + js : js ,
194196 sourceMap : sourceMap ,
195197 lazy : isLazy ,
196198 } ) ;
You can’t perform that action at this time.
0 commit comments