Skip to content

Commit 2e83b06

Browse files
author
Guillaume Chau
committed
Fix Meteor 1.5 support
1 parent 2898c51 commit 2e83b06

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
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/>

packages/vue-component/plugin/vue-compiler.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff 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(/(^|\/)(node_modules|imports)\//);
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
});

0 commit comments

Comments
 (0)