Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions packages/vue-component/plugin/vue-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,22 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {

const { js, templateHash } = generateJs(vueId, inputFile, compileResult)

let outputFilePath = inputFile.getPathInPackage();
// Meteor will error when loading .vue files on the server unless they are postfixed with .js
if (inputFile.getArch().indexOf('os') === 0 && inputFilePath.indexOf('node_modules') !== -1) {
outputFilePath += '.js';
}

// Including the source maps for .vue files from node_modules breaks source mapping.
const sourceMap = inputFilePath.indexOf('node_modules') === -1
? compileResult.map
: undefined;

// Add JS Source file
inputFile.addJavaScript({
path: inputFile.getPathInPackage(),
path: outputFilePath,
data: js,
sourceMap: compileResult.map,
sourceMap: sourceMap,
lazy: false,
});

Expand Down Expand Up @@ -610,7 +621,7 @@ function generateJs (vueId, inputFile, compileResult, isHotReload = false) {
js += `__vue_options__.packageName = '${inputFile.getPackageName()}';`;

// Export
js += `module.export('default', exports.default = __vue_script__);`;
js += `module.export('default', exports.default = __vue_script__);exports.__esModule = true;`;

if (!isHotReload) {
// Hot-reloading
Expand Down