[SOLVED] Ignore File for Compilation

Hi,

is there a way to ignore specific files, so they don’t get compiled by babel but get included in the final bundle?

Background: I have a big js file which is already es5, and I don’t want meteor to transpile it again.

You could add a local package which doesn’t use ecmascript?

I think making the extension *.min.js might work

@veered I don’t see any speed improvements using the *.min.js trick. The “big” file is about 22k lines of es5. Maybe it is not big enough to notice a difference.

@coagmano can you please elaborate on what you mean by that?

Sure, the instructions in the guide are pretty good:
https://guide.meteor.com/writing-atmosphere-packages.html

The minimum you need is a folder in /packages/ with a package.js file describing the package and the js file.

As an example, create the folder and files:

/packages/example-package/
/packages/example-package/package.js
/packages/example-package/example-lib.js

And in the package.js:

Package.describe({
    name: 'ni-ko-o-kin:example',
    version: '1.0.0',
    summary: "Don't compile me please",
});

Package.onUse(function(api) {
    api.versionsFrom('1.8');
    api.mainModule('example-lib.js', ['server', 'client'], { lazy: true });
});

And declare any dependecies with api.use
IIRC as long as it doesn’t have api.use('ecmascript'), it shouldn’t compile this as well

1 Like

Thx!

The package works, but only if I include api.use('ecmascript'). Otherwise I get an ‘Package not found’. But that’s exactly what I don’t wont. Btw: It client side only - if that matters…

I’m trying to import a file like this one: https://gist.github.com/ni-ko-o-kin/88f69e68e3268776a865f24c995be1bf

Does it work if you include modules instead of ecmascript?

1 Like

The other option is to include it as a node_module. You could install it from a git url?

It works using modules instead of ecmascript! Thank you very much!! :smile:

1 Like

btw: I’m using the package for this example Meteor-Elm-Example