I am working on a large business software that is slowly porting to use Webpack on all pages. I want to start using some typescript helper code embedded in a web package in pages that have not yet started using webpack - they include scripts in the old-fashioned way.
Here are the relevant parts of the configuration:
entry: {
vendor: [
],
es5Compatibility: [
'Utility/ES5Compatibility.ts'
]
},
output: {
path: path.join(__dirname, 'Scripts/bundle'),
filename: '[name].[chunkhash].bundle.js',
chunkFilename: '[id].chunk.js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
})
new HtmlWebpackPlugin({
chunks: ['vendor'],
template: 'bundleTemplate.ejs',
inject: false,
filename: '_VendorBundle.html'
}),
new HtmlWebpackPlugin({
chunks: ['es5Compatibility'],
template: 'bundleTemplate.ejs',
inject: false,
filename: '_ES5CompatibilityBundle.html'
}),
new webpack.HashedModuleIdsPlugin(),
]
The problem is that when _ES5CompatibilityBundle.htmlincluded in the page without VendorBundle.html, I get the following Javascript error, since Webpack expects the provider package to be included:
Uncaught ReferenceError: webpackJsonp is not defined
, Webpack ES5 "" , -?