Expose javascript globals bundled via webpack

后端 未结 5 2055
鱼传尺愫
鱼传尺愫 2020-12-09 03:54

The Problem

I feel like this should be more straightforward than it is. I need to access all my javascript libraries from the frontend and because I\'m integrating

5条回答
  •  一个人的身影
    2020-12-09 04:21

    I've had the same problem and the best solution I've found is using webpack-concat-plugin.

    What it does:

    • Concats everything to a single file
    • Allows me to specify the resulting file name, including [cache] template to do cache busting
    • Adds itself via HtmlWebpackPlugin to the resulting html

    The only thing it doesn't do is not-leaking all the globals to the global scope.

提交回复
热议问题