Skip to content

Commit

Permalink
Merge pull request #28 from mbabker/patch-1
Browse files Browse the repository at this point in the history
Account for temporary mix.js chunk
  • Loading branch information
Elhebert authored Mar 26, 2021
2 parents e754578 + 64fdaf1 commit e0101e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/SriPlugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require('laravel-mix/src/helpers')
const collect = require('collect.js');
const path = require('path');

class SriPlugin {
Expand All @@ -11,6 +12,11 @@ class SriPlugin {
let assets = Object.assign({}, stats.toJson().assetsByChunkName)
let hashes = {}

// If there's a temporary mix.js chunk, we can safely remove it.
if (assets.mix) {
assets.mix = collect(assets.mix).except('mix.js').all();
}

flatten(assets).forEach(asset => {
if (asset[0] !== '/') {
asset = `/${asset}`
Expand Down

0 comments on commit e0101e0

Please sign in to comment.