vue3-sfc-loader icon indicating copy to clipboard operation
vue3-sfc-loader copied to clipboard

Deeper Babel configuration. Passing options.

Open ru5t opened this issue 2 years ago • 2 comments

Hi there! I'm building a frontend for embedded device so working with CDN since there's no place for all required modules. Here is the case: Vue single file component imports js file. Vue file itself is loaded using sfc-loader. This action leads to method transformJSCode and to assertModuleNodeAllowed call for js file. And it fails since it is not a module but a plain javascript.

As I can see, there's nothing passed at the Babel parser level except of additionalBabelParserPlugins.

Is there a way to pass options to parser directly? I'm very interested in allowImportExportEverywhere flag.

So the questions are:

  • is it possible now to pass required Babel options?
  • Are there plans to implement this feature?

ru5t avatar Dec 25 '23 18:12 ru5t

Hi ru5t, you really want to use import and export from everywhere ?

FranckFreiburger avatar Jan 06 '24 20:01 FranckFreiburger

Hi, Frank. For sure, in general - no. But in some particular cases in the limited and controlled context - probably. I mean that it is an exception that vue single file component is going to be loaded like this. But to have possibility to tune babel's logic deeper, if needed, would be good. This particular case was solved by rewriting of provided js library in CommonJS manner. It was small enough to do so. So, basically absence of this feature is not slowing process. But it seems to me, that deeper configuration possibilities could be of some use for someone.

ru5t avatar Jan 07 '24 09:01 ru5t