Plugin Files not allowed to export objects

Hi all,

In my project I need some npm modules, including babelify and babel-preset-es2015.
Problem is that babel-preset-es2015 exports objects, which is obviously not allowed by Cocos Creator, according to my build error:

Build Failed: Compile error: Plugin/Preset files are not allowed to export objects, only functions. In D:\Dokumente\Cocos2D\Whammychat\node_modules\babel-preset-es2015\lib\index.js while parsing file: D:\Dokumente\Cocos2D\Whammychat\node_modules\tmi.js\index.js
at Readable. (D:\Programme\Cocos211\resources\app.asar\editor\page\build\compile-worker.js:1:3617)
at emitOne (events.js:96:13)
at Readable.emit (events.js:191:7)
at Labeled. (D:\Programme\Cocos211\resources\app.asar\node_modules\read-only-stream\index.js:28:44)
at emitOne (events.js:96:13)
at Labeled.emit (events.js:191:7)
at Labeled. (D:\Programme\Cocos211\resources\app.asar\node_modules\stream-splicer\index.js:130:18)
at emitOne (events.js:96:13)
at Labeled.emit (events.js:191:7)
at Deps. (D:\Programme\Cocos211\resources\app.asar\node_modules\stream-splicer\index.js:130:18)
at r.waterfall.r (D:\Programme\Cocos211\resources\app.asar\editor\lib\builder\index.js:1:3393)
at D:\Programme\Cocos211\resources\app.asar\node_modules\async\lib\async.js:52:16
at D:\Programme\Cocos211\resources\app.asar\node_modules\async\lib\async.js:696:30
at D:\Programme\Cocos211\resources\app.asar\node_modules\async\lib\async.js:167:37
at D:\Programme\Cocos211\resources\app.asar\node_modules\async\lib\async.js:1209:30
at Gulp.doneCallback (D:\Programme\Cocos211\resources\app.asar\editor\core\gulp-build.js:1:28089)
at Gulp.Orchestrator.stop (D:\Programme\Cocos211\resources\app.asar\node_modules\orchestrator\index.js:150:9)
at C (D:\Programme\Cocos211\resources\app.asar\editor\core\gulp-build.js:1:6396)
at D:\Programme\Cocos211\resources\app.asar\editor\core\gulp-build.js:1:8465

Why are plugins not allowed to export objects? Is there any workaround or option to allow them to export objects?

Thanks in advance

@slackmoehrle Sorry for tagging you almost instantly, but this is kind of urgent.
I hope you understand this :slight_smile:

I dont know the answer, but let’s tag @jare and ask him to help us.

1 Like

@jare Sorry for tagging you as well, but as said, it is urgent :slight_smile:
Even if there is no solution, please just tell me so I can be sure about it