sbmzhcn
V2EX  ›  问与答

webpack 如何生成一个 js 文件,只包含一个变量,不要使用 babel-loader

  •  
  •   sbmzhcn · Mar 13, 2019 · 1761 views
    This topic created in 2622 days ago, the information mentioned may be changed or developed.

    有一个需求,要生成一个配置文件 config.js 里面的内容为

    _jsonp_fun({
        "k": "v"
    })
    

    __jsonp_fun 里面就是一个 json 对象, 现在有一个 json 文件 config.json 如何生成上面的 config.js 这样的文件内容。

    webpack 应该如何配置

    1 replies    2019-03-13 19:23:18 +08:00
    LeoEatle
        1
    LeoEatle  
       Mar 13, 2019
    直接用 raw-loader 了解一下
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2717 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 15:47 · PVG 23:47 · LAX 08:47 · JFK 11:47
    ♥ Do have faith in what you're doing.