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 1
1
<p align =" center " ><img src =" https://github.com/Akryum/vue-meteor/raw/master/vue%2Bmeteor.png " ></p >
2
2
3
3
<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 >
6
6
</p >
7
7
8
8
<br />
Original file line number Diff line number Diff line change @@ -154,6 +154,8 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
154
154
// Lazy load files from NPM packages or imports directories
155
155
const isLazy = ! ! inputFilePath . match ( / ( ^ | \/ ) ( n o d e _ m o d u l e s | i m p o r t s ) \/ / ) ;
156
156
157
+ const lazyCSS = ! isDev && isLazy && inputFile . getArch ( ) . indexOf ( 'web' ) !== - 1
158
+
157
159
// Style
158
160
let css = '' ;
159
161
let cssHash = '' ;
@@ -165,11 +167,11 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
165
167
cssHash = Hash ( css ) ;
166
168
167
169
//console.log(`css hash: ${cssHash}`);
168
- if ( ! isDev && isLazy ) {
170
+ if ( lazyCSS ) {
169
171
// 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
173
175
` ;
174
176
}
175
177
}
@@ -181,16 +183,16 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
181
183
if ( inputFile . getArch ( ) . indexOf ( 'os' ) === 0 && inputFilePath . indexOf ( 'node_modules' ) !== - 1 ) {
182
184
outputFilePath += '.js' ;
183
185
}
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.
186
188
const sourceMap = inputFilePath . indexOf ( 'node_modules' ) === - 1
187
189
? compileResult . map
188
190
: undefined ;
189
191
190
192
// Add JS Source file
191
193
inputFile . addJavaScript ( {
192
194
path : outputFilePath ,
193
- data : isLazy && ! isDev ? css + js : js ,
195
+ data : lazyCSS ? css + js : js ,
194
196
sourceMap : sourceMap ,
195
197
lazy : isLazy ,
196
198
} ) ;
You can’t perform that action at this time.
0 commit comments