Parcel: Output code as a simple IFEE

Created on 22 Nov 2018  ยท  1Comment  ยท  Source: parcel-bundler/parcel

โ” Question

Is it possible to disable the added module wrapping code? I.e:

parcelRequire = (function (modules, cache, entry, globalName) {   [...]

And instead encapsulate the output in a simple IIFE? I.e:

(function() {

})();

๐Ÿ”ฆ Context

I'm trying to convert a .vue file to vanilla js to be used as a Vue component in the backend for a specific CMS. Parcel is able to convert the .vue-file to js and I am able to use the component in my CMS. But, looking at the js output, there is over 1 kB of wrapper code.

In my case, my Vue component does not need to be imported by the CMS. The CMS is built in a way that custom plugins/fields needs to add themself to the plugin registry.

Therefore this module bundling wrapper code is unnecessary in this case and only adds a lot of overhead to the plugins. A better solution would be an option to let Parcel wrap the output in a simple IIFE to encapsulate it.

๐Ÿ’ป Code Sample

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.10.3
| Node | 10.13.0
| npmn | 6.4.1
| Operating System | macOS 10.14.1

Most helpful comment

Just found out about the --experimental-scope-hoisting setting that seems to do what I want.

Feel free to close this issue if you haven't got something else to add.

>All comments

Just found out about the --experimental-scope-hoisting setting that seems to do what I want.

Feel free to close this issue if you haven't got something else to add.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philipodev picture philipodev  ยท  3Comments

donaldallen picture donaldallen  ยท  3Comments

jsftw86 picture jsftw86  ยท  3Comments

medhatdawoud picture medhatdawoud  ยท  3Comments

jzimmek picture jzimmek  ยท  3Comments