Reputation: 275
How can I access the [name] and [contenthash] within the my code itself.
I want my loader.js file to reference the other script's file name.
webpack.config.js:
module.exports = {
entry: {
app: './src/index.js',
loader: './src/loader.js'
},
output: {
filename: '[name].[contenthash].js',
path: path.resolve(__dirname, 'dist')
},
}
Upvotes: 2
Views: 2579
Reputation: 6841
Add the ExtendedAPIPlugin
new webpack.ExtendedAPIPlugin()
__webpack_hash__
being a global, you can access everywhere.
Upvotes: 1