sbmzhcn
V2EX  ›  问与答

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

  •  
  •   sbmzhcn · Mar 13, 2019 · 1822 views
    This topic created in 2660 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   ·   5585 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 06:34 · PVG 14:34 · LAX 23:34 · JFK 02:34
    ♥ Do have faith in what you're doing.