lux icon indicating copy to clipboard operation
lux copied to clipboard

Option to not transpile fixtures (or other folders)

Open ralfschimmel opened this issue 8 years ago • 3 comments

First up: great framework!

We have a pretty large set of fixtures, only used when seeding the db. When the application is building, it runs all these files through rollup and babel, which takes up to 5 minutes, whereas without the fixtures the app builds in 5 seconds.

I tried adding the fixtures folder to the .babelrc ignore, and run babel with --copy-files though this throws an error from rollup. I'm not familiar with rollup but it seems that the .babelrc settings are not respected by rollup. The fixtures are simple module exports which run fine in native v6/v7 and do not need transpiling.

Any hints how to achieve this? Thanks.

ralfschimmel avatar Dec 30 '16 09:12 ralfschimmel

First up: great framework!

Thanks!

The fixtures are simple module exports which run fine in native v6/v7 and do not need transpiling.

This brings up a good point. Currently this is not possible in the latest stable release. We could easily implement this by using some sort of prefix on imported modules.

// Before Build
import FIXTURES from 'external:<PATH_TO_FIXTURES>';

// After Build
const FIXTURES = '<PATH_TO_FIXTURES>';

Any thoughts on that API?

zacharygolba avatar Dec 30 '16 18:12 zacharygolba

Your solution sounds good to me.

However I think we can also achieve this using babel's ignore and rollup's exclude, using their native capabilities to achieve the desired solution prevents adding complexity to lux, and a simple mention in the docs on how to exclude files and folders from transpiling would suffice.

ralfschimmel avatar Dec 31 '16 15:12 ralfschimmel

However I think we can also achieve this using babel's ignore and rollup's exclude.

That's how this would be handled internally. The reason the import api would exist is to prevent users from having to write their own rollup config. If we give users the ability to write there own rollup config, that could cause a whole new class of bugs from invalid config files.

zacharygolba avatar Jan 02 '17 16:01 zacharygolba