bogusfocused / html-webpack-inline-chunk-plugin

A webpack plugin that inlines chunk in html-webpack-plugin.
34 stars 6 forks source link

Uncaught SyntaxError: Unexpected token : #6

Open marcushultman opened 6 years ago

marcushultman commented 6 years ago

What happened? Browser console error Uncaught SyntaxError: Unexpected token : at Object.217

Versions Chrome 62.0.3202.89 Webpack 3.8.1 html-webpack-plugin 2.30.1 html-webpack-inline-chunk-plugin 1.1.1

More details webpack.config.js:

new HtmlWebpackPlugin({
  filename: 'index.html',
  template: path.join(__dirname, 'src', 'index.html'),
  chunks: ['runtime', 'dev', 'vendor', 'index'],
}),
new HtmlInlineChunkWebpackPlugin({
  inlineChunks: ['runtime', 'dev']
}),

Inlined chunk (looks wrong):

<script type="text/javascript">webpackJsonp([4],{

/***/ 216:
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(15);
__webpack_require__(19);
module.exports = __webpack_require__(217);

/***/ }),

/***/ 217:
/***/ (function(module, exports) {

eval("console.log('dev');//# sourceURL=[module]\nsourceURL=webpack-internal:///217\n");

/***/ })

},[216]);</script>

Evaluated:

console.log('dev');//# sourceURL=[module]
sourceURL=webpack-internal:///217