Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

es3 support #364

Closed
sormy opened this issue Dec 21, 2018 · 5 comments
Closed

es3 support #364

sormy opened this issue Dec 21, 2018 · 5 comments

Comments

@sormy
Copy link
Contributor

sormy commented Dec 21, 2018

Current version of plugin doesn't produce valid es3 code. This fix is easy. Let me know if you are open to accept this change and I will submit a PR (replace .default with ["default"]):

diff -ur rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js rollup-plugin-commonjs.new/dist/rollup-plugin-commonjs.cjs.js
--- rollup-plugin-commonjs.old/dist/rollup-plugin-commonjs.cjs.js	1985-10-26 04:15:00.000000000 -0400
+++ rollup-plugin-commonjs.new/dist/rollup-plugin-commonjs.cjs.js	2018-10-27 00:04:53.000000000 -0400
@@ -13,7 +13,7 @@
 var EXTERNAL_PREFIX = '\0commonjs-external:';
 var HELPERS_ID = '\0commonjsHelpers';

-var HELPERS = "\nexport var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nexport function commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');\n}\n\nexport function unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;\n}\n\nexport function createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nexport function getCjsExportFromNamespace (n) {\n\treturn n && n.default || n;\n}";
+var HELPERS = "\nexport var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nexport function commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');\n}\n\nexport function unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nexport function createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nexport function getCjsExportFromNamespace (n) {\n\treturn n && n['default'] || n;\n}";

 var isCjsPromises = Object.create(null);
@sormy
Copy link
Contributor Author

sormy commented Mar 3, 2019

Ping!

@nvdlug
Copy link

nvdlug commented Mar 28, 2019

I can't disable the linter of this program so I have to avoid reserved keywords like default. Please fix this.

@sormy
Copy link
Contributor Author

sormy commented Mar 30, 2019

will // eslint-disable-next-line be ok? I can submit PR.

@sormy
Copy link
Contributor Author

sormy commented Mar 30, 2019

I submitted a PR that is passing all tests for this issue: #381

@nvdlug
Copy link

nvdlug commented Apr 1, 2019

Thanks, that fixed it!

Sadly // eslint-disable-next-line does not work in the program I upload my code to (Optimizely).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants