Wednesday 1 September 2021

Webpack: use data from parent directory witout copying

I have a project folder structured like this:

project-name/   
  data/
   data.csv
  dist/
   index.js
  src/
   index.js

And want a remote directory like this:

project-name/   
  data/
   data.csv
  dist/
   index.js
    > `doSomething("../data/data.csv")`

How do I make this work in both webpack-dev-server and in the production path? If I use copywebpack plugin, then the data goes inside the dist/, which I don't want. But if I use a relative directory without copying the data, then the build fails.

Thank you!



from Webpack: use data from parent directory witout copying

No comments:

Post a Comment