Hello all,
I have an large legacy Meteor application I am trying to refactor and update to the latest version of Meteor and I’m running in to an issue with the .babelrc
file and my local packages (everything in the ./packages/*
). As of version 1.3.4 it is possible to use the .babelrc
file to add additional transforms like ```transform-class-properties``. But if I add a property to one of the classes in one of my packagess the application will not start and throw out an error along lines of:
=> Errors prevented startup:
While processing files with ecmascript (for target web.browser):
packages/andre:package-with-class-properties/package-with-class-properties.js:6:1: /packages/andre:package-with-class-properties/package-with-class-properties.js: Missing class properties transform.
While building for os.osx.x86_64:
imports/import-with-class-properties/index.js:2:1: /imports/import-with-class-properties/index.js: Missing class properties transform.
While processing files with ecmascript (for target os.osx.x86_64):
packages/andre:package-with-class-properties/package-with-class-properties.js:6:1: /packages/andre:package-with-class-properties/package-with-class-properties.js: Missing class properties transform.
=> Your application has errors. Waiting for file change.
I have created an experimentation project which can be found at: https://github.com/AndreSteenveld/meteor-import-from-packages
So far I’ve found this forum post by @clayne, which does suggest it is possible to use the transforms in packages. Although I think it uses the gadicc:ecmascript-hot
package for complication instead of the default ecmascript
package, which isn’t an option for me. A few posts later @benjamn suggests that the .babelrc
file will work everywhere.
To make sure I have the same .babelrc
file in every package I’ve tried symlinking it in to all the package directories (in the example project that would be $ln -s ./.babelrc ./packages/package-with-class-properties/.babelrc
). But that causes the application to go in to an infinite loop during the startup:
=> Started MongoDB.
/Users/andre/.meteor/packages/ecmascript/.0.4.6_1.mz2y2r++os+web.browser+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:165
throw error;
^
Error: ELOOP, too many symbolic links encountered '/Users/andre/mkbid/importing-packages/packages/package-with-class-properties/.babelrc'
at Object.fs.statSync (fs.js:696:18)
at Object.wrapper (/tools/fs/files.js:1374:35)
at Object.files.(anonymous function) [as stat] (/tools/fs/files.js:1475:27)
at /tools/fs/watch.js:281:25
at Array.forEach (native)
at Function._.each._.forEach (/Users/andre/.meteor/packages/meteor-tool/.1.3.4_1.p7w3mw++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
at readDirectory (/tools/fs/watch.js:276:5)
at Watcher._fireIfDirectoryChanged (/tools/fs/watch.js:409:23)
at /tools/fs/watch.js:670:12
at Array.forEach (native)
at Function._.each._.forEach (/Users/andre/.meteor/packages/meteor-tool/.1.3.4_1.p7w3mw++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
at Watcher._checkDirectories (/tools/fs/watch.js:659:7)
at new Watcher (/tools/fs/watch.js:356:10)
at /tools/fs/watch.js:705:19
at Function.time (/tools/tool-env/profile.js:305:10)
at Object.isUpToDate (/tools/fs/watch.js:703:18)
at IsopackCache._checkUpToDate (/tools/isobuild/isopack-cache.js:445:18)
at /tools/isobuild/isopack-cache.js:330:29
at /tools/utils/buildmessage.js:359:18
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:352:34
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:350:23
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at Object.enterJob (/tools/utils/buildmessage.js:324:26)
at IsopackCache._loadLocalPackage (/tools/isobuild/isopack-cache.js:315:18)
at /tools/isobuild/isopack-cache.js:249:16
at Function.time (/tools/tool-env/profile.js:305:10)
at /tools/isobuild/isopack-cache.js:248:17
at /tools/utils/buildmessage.js:359:18
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:352:34
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:350:23
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at Object.enterJob (/tools/utils/buildmessage.js:324:26)
at IsopackCache._ensurePackageLoaded (/tools/isobuild/isopack-cache.js:239:20)
at /tools/isobuild/isopack-cache.js:76:14
at /tools/packaging/package-map.js:57:7
at Function._.each._.forEach (/Users/andre/.meteor/packages/meteor-tool/.1.3.4_1.p7w3mw++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:87:22)
at [object Object].eachPackage (/tools/packaging/package-map.js:49:7)
at IsopackCache.buildLocalPackages (/tools/isobuild/isopack-cache.js:75:24)
at /tools/project-context.js:771:25
at /tools/utils/buildmessage.js:359:18
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:352:34
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:350:23
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at Object.enterJob (/tools/utils/buildmessage.js:324:26)
at ProjectContext._.extend._buildLocalPackages (/tools/project-context.js:770:18)
at /tools/project-context.js:281:9
at /tools/utils/buildmessage.js:359:18
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:352:34
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:350:23
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at Object.enterJob (/tools/utils/buildmessage.js:324:26)
at ProjectContext._completeStagesThrough (/tools/project-context.js:271:18)
at /tools/project-context.js:263:12
at Function.run (/tools/tool-env/profile.js:489:12)
at ProjectContext.prepareProjectForBuild (/tools/project-context.js:262:13)
at /tools/runners/run-app.js:557:29
at /tools/utils/buildmessage.js:271:13
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:264:29
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:262:18
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at /tools/utils/buildmessage.js:253:23
at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
at Object.capture (/tools/utils/buildmessage.js:252:19)
at bundleApp (/tools/runners/run-app.js:556:31)
at AppRunner._runOnce (/tools/runners/run-app.js:634:35)
at AppRunner._fiber (/tools/runners/run-app.js:887:28)
at /tools/runners/run-app.js:411:12
My questions/issues are:
- How do I use the
.babelrc
file in my project and how do I make sure my local packages are converted as well? - If that is not possible is there an work around, that will not prevent me following the Meteor update path?
The application this applies to has roughly 40 packages, and a total line count of ~80k. I have to stress the fact that it is not the best designed application so “just” moving all the packages to the ./imports/
directory is not really an option.