Javascript function is undefined after running webpack

前端 未结 1 1159
南笙
南笙 2021-01-22 16:10

Here is my webpack.config.js

module.exports = {
    entry: \"./src/index.js\",//path relative to this file
    output: {
        filename: \"../frontEnd/bundle.         


        
相关标签:
1条回答
  • 2021-01-22 16:53

    You aren't exporting test() to window.

    module.exports = {...} won't automagically get injected into window, but:

    • you can set the output.libraryTarget: 'window' and output.library: 'something' configuration options and get window.something.test() (docs here), or
    • you can manually do window.test = test; at the end of your Webpack entry point instead of exporting things.
    0 讨论(0)
提交回复
热议问题