[英]generate JSON file during Webpack build
I'm using Webpack to build my assets for Chrome Extension. 我正在使用Webpack为Chrome扩展程序构建资产。 Usually in the
/dist
you should have some JS files, some HTML files, and manifest.json
通常在
/dist
您应该有一些JS文件,一些HTML文件和manifest.json
Previously I had this file created somewhere and using 'copy-webpack-plugin'
I simply copied that to the /dist
folder, like this: 以前,我在某个地方创建了此文件,然后使用
'copy-webpack-plugin'
将其复制到/dist
文件夹,如下所示:
But now, I need to generate this manifest.json
dynamically. 但是现在,我需要动态生成此
manifest.json
。 I need to make AJAX request, get some data needed in the manifest.json
, generate this file, and then put it in the /dist
folder. 我需要发出AJAX请求,在
manifest.json
获取一些所需的数据,生成此文件,然后将其放在/dist
文件夹中。
I'm familiar with Node.js and I know how to get AJAX data. 我熟悉Node.js,并且知道如何获取AJAX数据。 I may be able to google how to generate JSON file.
我也许可以用谷歌搜索如何生成JSON文件。 But how can I connect this Node.js app with Webpack build I have no idea.
但是我不知道如何将这个Node.js应用程序与Webpack构建连接。 Should I use a plugin?
我应该使用插件吗?
Please help me with this. 请帮我解决一下这个。 I'm using
"webpack": "^3.0.0",
我正在使用
"webpack": "^3.0.0",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.