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. ![]() In this file, set up your webpack config with all the rules that apply to both development and production. If you find that a lot of your configuration is duplicated between the two, you could create a fourth file called or similar. 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. When I run webpack -mode production on my local environment it works fine. Next, populate your dev and prod config files as you normally would your . I added TailwindCSS to my Vue2 project that is compiled using Webpack 5. 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. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |