0

I have my webpack config as below

entry : {
  lib: "./path/to/index",
  sublib: "./path/to/sub/index"
},
output : {
  filename: "[name]/[name].lib.js",
  path: __dirname + "/dist",
}

It currently building in below folder structure

- src
  |
  |- /dist
  |-- lib/lib.lib.js
  |-- sublib/sublib.lib.js

But what I want is both should build in same folder i.e., lib like below

- src
  |
  |- /dist
  |-- lib/lib.lib.js
  |---- lib.lib.js
  |---- sublib.lib.js

And I don't want to make two different webpack config & I don't even want to merge my class in single export file because I want them in be separate.

Any Idea how I can achieve this I am using webpack 4. Any help will be appreciated.

Amin Kodaganur
  • 646
  • 6
  • 19

1 Answers1

0

I figured out a workaround for it here what worked for me While giving library name in entry object just make your sublib under lib. your entry object should look like below

entry : {
  lib: "./path/to/index",
  "lib/sublib": "./path/to/sub/index"
}

so this will export your sublib in lib folder. this will be very helpful when have written a Jenkins jobs to pic library from lib folder to publish in your npm repo

Amin Kodaganur
  • 646
  • 6
  • 19