The webpack plugin extract-text-webpack-plugin adds static resources

Article reference

https://github.com/jantimon/html-webpack-plugin

 

A problem was encountered during development:

After webpack is packaged, some configuration files are actually in the compressed files. There is no way to freely modify and configure them. If you want to modify, you must repackage and build each time. Therefore, I thought of a solution. First in the target html file Use the <script src> tag to import a configuration resource file, and then import the business logic code packaged by webpack. In this way, the previous configuration file can be used as a variable as the configuration information of the business logic file after packaging, so the tester can intuitively modify the configuration file information.

 

 

1. Modify the template introduced by the html-webpack-plugin plugin

 

Write the configuration file that needs to be imported in the template.

 

2. Use the extract-text-webpack-plugin plugin to dynamically configure the resource files that need to be imported

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326393589&siteId=291194637