In order to merge the base config into the others, you'll need webpack-merge. In your dev and prod config files, only include the rules that apply to that environment. While we will separate the production and development specific bits out, note that we'll. ![]() With this logical separation at hand, we typically recommend writing separate webpack configurations for each environment. In this file, set up your webpack config with all the rules that apply to both development and production. In production, our goals shift to a focus on minified bundles, lighter weight source maps, and optimized assets to improve load time. css modules in entry chunks into a separate CSS file. From their docs: It moves all the required. If you find that a lot of your configuration is duplicated between the two, you could create a fourth file called or similar. mv cp We will need a development dependency, Extract Text Plugin. Now you can run webpack -env=dev or webpack -env=prod to run the respective webpack configs. In you may want to run a dev server and inline all your styles, while in you may want to extract your styles to a CSS file, uglify your JS, and deploy your build directory to a server. Next, populate your dev and prod config files as you normally would your. ![]() Now the webpack command will take an argument env, which tells it which config file to use. ![]() Enter fullscreen mode Exit fullscreen mode
0 Comments
Leave a Reply. |