Javascript Function Is Undefined After Running Webpack
Here is my webpack.config.js module.exports = { entry: './src/index.js',//path relative to this file output: { filename: '../frontEnd/bundle.js',//path relative to
Solution 1:
You aren't exporting test()
to window
.
module.exports = {...}
won't automagically get injected into window
, but:
- you can set the
output.libraryTarget: 'window'
andoutput.library: 'something'
configuration options and getwindow.something.test()
(docs here), or - you can manually do
window.test = test;
at the end of your Webpack entry point instead of exporting things.
Post a Comment for "Javascript Function Is Undefined After Running Webpack"