How can I build with Babel (while preserving the source's folder structure) with Webpack?

Viewed 703

I have a project with a hierarchy something like this:

-src/ -app.js (only accesses server-side code) -server/ -models/ -routes/ ... -client/ -views/ -scss/ -style1.scss -style2.scss ... -js/ -index.js (es6) -other-page.js (es6) ... ... -.babelrc -package.json -webpack.config.js ...

and I want Webpack to copy everything within src, replacing .js files with Babel-compiled equivalents, and replacing .scss files with compiled CSS. Like this:

-dist/ -app.js -server/ -models/ -routes/ ... -client/ -views/ -css/ -style1.css -style2.css -js/ -index.js (now compiled) -other-page.js (now compiled) ... ...

There are non-js files within src/server/, so I don't think it's possible to combine everything inside of it into app.js. Still, any help would be appreciated regarding my question.

1 Answers
Related