We're trying to compose a simple dev setup based on the Parcel bundler. The goal is to build two separate things:
- a JS app with entry point at
src/app.jsxand output target atdist/js/app.js; - a plain SCSS bundle with entry point at
styles/app.scssand output atdist/css/app.css;
The two items are not related and no CSS in JS is possible. Another limitation: we can not use any CLI instruments which leaves us with the Parcel bundler JS API only.
After reading the relevant Parcel documentation, one might think that the following should do the job:
const bundler = new Parcel({
targets: {
js: {
distDir: 'dist/js',
source: 'src/app.jsx',
},
css: {
distDir: 'dist/css',
source: 'styles/app.scss',
},
},
defaultConfig: '@parcel/config-default',
mode: 'development',
shouldAutoInstall: true,
shouldDisableCache: true,
});
await bundler.run();
Although it does not. Instead, the targets input is completely ignored and nothing is being built at all. Yet we're trying to find a clue by studying the source code, hopefully this post might be noticed by someone who already faced a similar problem or a random Parcel contributor who's familiar with the source code and various JS API use cases.
Would appreciate any help/input. Thanks in advance.