Skip to content

Commit

Permalink
webpack:dev: Don't read manifest files using require()
Browse files Browse the repository at this point in the history
This breaks when we bundle the same config file in with
the server-side build. Instead, read them using fs.readFileSync()
  • Loading branch information
smspillaz committed Feb 25, 2018
1 parent d3b7ed1 commit 3b4f400
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internals/webpack/webpack.dev.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const logger = require('../../server/logger');
const pkg = require(path.resolve(process.cwd(), 'package.json'));

// We don't want webpack to try resolving this during builds, use
// fs.readFileSync instead
const pkg = JSON.parse(fs.readFileSync((path.resolve(process.cwd(), 'package.json'))));
const dllPlugin = pkg.dllPlugin;

const plugins = [
Expand Down Expand Up @@ -105,7 +108,7 @@ function dependencyHandlers() {
return [
new webpack.DllReferencePlugin({
context: process.cwd(),
manifest: require(manifestPath), // eslint-disable-line global-require
manifest: JSON.parse(fs.readFileSync(manifestPath)),
}),
];
}
Expand All @@ -126,7 +129,7 @@ function dependencyHandlers() {

return new webpack.DllReferencePlugin({
context: process.cwd(),
manifest: require(manifestPath), // eslint-disable-line global-require
manifest: JSON.parse(fs.readFileSync(manifestPath)),
});
});
}

0 comments on commit 3b4f400

Please sign in to comment.