0

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.jsx and output target at dist/js/app.js;
  • a plain SCSS bundle with entry point at styles/app.scss and output at dist/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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.