Skip to content

How to set up shared resources ? #88

Answered by webdiscus
KirovAI asked this question in Q&A
Discussion options

You must be logged in to vote

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 and script tags, e.g.:

html
  head
    link(href=require('./style.scss') rel='stylesheet')
    script(src=require('./main.js') defer='defer')
  body
    h1 Hello Pug!

In the main.js import all you other JS files:

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 lodash code.
What you see in the Webpack documentation only makes sense if you create a JS library with many JS output files.
Bu…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by KirovAI
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants