Skip to content
Permalink
Browse files

fix: proper asset attribution (#554)

BREAKING CHANGE:

Bundles will now have a `assets` and `dynamicAssets` array on them, and the metadata file will now contain an `assets` and `dynamicAssets` keys on them as well.

Both `assets` and `dynamicAssets` will only contain assets **directly** required by the bundle, instead of the bundle and all its dependencies.
  • Loading branch information...
tivac committed Jan 25, 2019
1 parent 14b232b commit 16fc75807a4c2820ea6a68bfc09e951dd9dd6414
@@ -41,15 +41,14 @@ module.exports = (opts) => {
Object.entries(chunks).forEach(([ entry, chunk ]) => {
const {
isAsset = false,
assets = [],
code = "",
dynamicImports = [],
} = chunk;

// Guard against https://github.com/rollup/rollup/issues/2659
const deps = dynamicImports.filter(Boolean);

if(isAsset || !deps.length || !assets.length) {
if(isAsset || !deps.length) {
return;
}

@@ -73,8 +72,10 @@ module.exports = (opts) => {
const [ statement, file ] = result;
const { index } = result;

if(chunks[file].assets) {
const imports = chunks[file].assets.map((dep) =>
const { dynamicAssets : assets = false } = chunks[file];

if(assets && assets.length) {
const imports = assets.map((dep) =>
`${options.loadfn}("./${dep}")`
);

Oops, something went wrong.

0 comments on commit 16fc758

Please sign in to comment.
You can’t perform that action at this time.