gajus / gajus/prepack-webpack-plugin

`chunk.hasRuntime is not a function` with Angular & Babel

Open
#18 11 comments 4 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
1k
Forks
31
PR merge metrics
No merged PRs in 30d

Description

There's prolly something really obvious here that I'm missing. Plugin seems to refuse to work with my stack, which is a fork of http://juhamust.github.io/silverplate

Steps to reproduce
- `git clone https://github.com/juhamust/silverplate.git`
- `npm install`
- `npm install prepack-webpack-plugin --save-dev`
- Do the minimal setup according to instructions

After this

```
$ git diff
diff --git a/package.json b/package.json
index 140f670..e6aaff4 100644
--- a/package.json
+++ b/package.json
@@ -51,6 +51,7 @@
"normalize.css": "^3.0.3",
"postcss-loader": "^0.8.0",
"precss": "^1.4.0",
+ "prepack-webpack-plugin": "^1.1.0",
"raw-loader": "^0.5.1",
"resolve-url": "^0.2.1",
"resolve-url-loader": "^1.4.3",
diff --git a/webpack.config.js b/webpack.config.js
index 3fa42f4..fbf1b74 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -5,6 +5,7 @@ var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
var autoprefixer = require('autoprefixer');
var precss = require('precss');
var packageInfo = require('./package.json');
+var PrepackWebpackPlugin = require('prepack-webpack-plugin').default;

module.exports = {
context: __dirname,
@@ -30,6 +31,8 @@ module.exports = {
},
noParse: [],
plugins: [
+ new PrepackWebpackPlugin({
+ }),
new ExtractTextPlugin('app.css', { allChunks: true }),
new HtmlWebpackPlugin({
version: packageInfo.version,
```

Then fire it up

```
$ npm start
[...]
/home/tero/src/silverplate/node_modules/prepack-webpack-plugin/dist/PrepackPlugin.js:27
return chunk.hasRuntime() && chunk.isInitial();
^

TypeError: chunk.hasRuntime is not a function
at isEntryChunk (/home/tero/src/silverplate/node_modules/prepack-webpack-plugin/src/PrepackPlugin.js:23:16)
```

There seems to be abundance of causes for `chunk.hasRuntime is not a function` and I couldn't find out how to make it work.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.