-
Using default entries I must specify option for it and set some properties in optimization section. Example from official webpack 5 documentation:
}, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @KirovAI, Using the pug-plugin the entrypoint is a Pug file, not JS file. html
head
link(href=require('./style.scss') rel='stylesheet')
script(src=require('./main.js') defer='defer')
body
h1 Hello Pug! In the import './index.js'; // <= here can be imported lodash
import './another-module.js'; // <= here can be imported lodash too
... Don't worry, Webpack optimizes the output JS bundle without the double If you will optimise bundle size in the case when the same lib, e.g. Are you using "html-webpack-plugin" in your project or pug-plugin to generate HTML? |
Beta Was this translation helpful? Give feedback.
-
Now I have completely switched to pug |
Beta Was this translation helpful? Give feedback.
Hi @KirovAI,
Using the pug-plugin the entrypoint is a Pug file, not JS file.
All style as script source files must be specified directly in the Pug via
link
andscript
tags, e.g.:In the
main.js
import all you other JS files:Don't worry, Webpack optimizes the output JS bundle without the double
lodash
code.What you see in the Webpack documentation only makes sense if you create a JS library with many JS output files.
Bu…