Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d357116

Browse files
authored
Merge pull request #9311 from meteor/package.json-browser-object-relative-style
Support object-valued "browser" field in package.json.
2 parents 6f716ee + 1cbcfb5 commit d357116

File tree

14 files changed

+1258
-107
lines changed

14 files changed

+1258
-107
lines changed

tools/isobuild/compiler-plugin.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var linker = require('./linker.js');
88
var util = require('util');
99
var _ = require('underscore');
1010
var Profile = require('../tool-env/profile.js').Profile;
11+
import assert from "assert";
1112
import {sha1, readAndWatchFileWithHash} from '../fs/watch.js';
1213
import LRU from 'lru-cache';
1314
import {sourceMapLength} from '../utils/utils.js';
@@ -1124,11 +1125,12 @@ export class PackageSourceBatch {
11241125
const appFilesWithoutNodeModules = [];
11251126

11261127
outputFiles.forEach(file => {
1127-
const parts = file.installPath.split("/");
1128+
const parts = file.absModuleId.split("/");
1129+
assert.strictEqual(parts[0], "");
11281130
const nodeModulesIndex = parts.indexOf("node_modules");
11291131

1130-
if (nodeModulesIndex === -1 || (nodeModulesIndex === 0 &&
1131-
parts[1] === "meteor")) {
1132+
if (nodeModulesIndex === -1 || (nodeModulesIndex === 1 &&
1133+
parts[2] === "meteor")) {
11321134
appFilesWithoutNodeModules.push(file);
11331135
} else {
11341136
// This file is going to be installed in a node_modules
@@ -1308,10 +1310,11 @@ export class PackageSourceBatch {
13081310
files: jsResources.map((inputFile) => {
13091311
fileHashes.push(inputFile.hash);
13101312
return {
1311-
installPath: inputFile.installPath,
1313+
absModuleId: inputFile.absModuleId,
13121314
sourceMap: !! inputFile.sourceMap,
13131315
mainModule: inputFile.mainModule,
13141316
imported: inputFile.imported,
1317+
alias: inputFile.alias,
13151318
lazy: inputFile.lazy,
13161319
bare: inputFile.bare,
13171320
};

0 commit comments

Comments
 (0)