Skip to content

Commit

Permalink
fix(webpack-plugin): fix TypeError when set writeToDisk true (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
dxx authored and gregberge committed Nov 27, 2018
1 parent 978a0c4 commit 2d1fb11
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/webpack-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const fs = require('fs')
class LoadablePlugin {
constructor({ filename = 'loadable-stats.json', writeToDisk = false } = {}) {
this.opts = { filename, writeToDisk }

// The Webpack compiler instance
this.compiler = null
}

handleEmit = (hookCompiler, callback) => {
Expand Down Expand Up @@ -104,6 +107,8 @@ class LoadablePlugin {
}

apply(compiler) {
this.compiler = compiler

// Add a custom output.jsonpFunction: __LOADABLE_LOADED_CHUNKS__
compiler.options.output.jsonpFunction = '__LOADABLE_LOADED_CHUNKS__'

Expand Down

0 comments on commit 2d1fb11

Please sign in to comment.