rollup / rollup-plugin-commonjs

This module has moved and is now available at @rollup/plugin-commonjs / https://github.com/rollup/plugins/blob/master/packages/commonjs
MIT License
502 stars 126 forks source link

Is something wrong when detect commonjs? #333

Closed jayjliang closed 4 years ago

jayjliang commented 6 years ago

version:~8.2.1 code:

//Extend jProto with methods which don't require arguments and work on columns.
this.j$ = this.jStat = (function(Math, undefined) {return jStat;}(Math));

output:

(function () {
'use strict';
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

//Extend jProto with methods which don't require arguments and work on columns.
commonjsGlobal.j$ = commonjsGlobal.jStat = function (Math, undefined) {
    return jStat;
}(Math);

question: when delete require in comment,this will become undefined like webpack so the way to detect commonjs is simply find the key word 'require'? this is a beautiful mistake...

shellscape commented 4 years ago

Hey folks (this is a canned reply, but we mean it!). Thanks to everyone who participated in this issue. We're getting ready to move this plugin to a new home at https://github.com/rollup/plugins, and we have to do some spring cleaning of the issues to make that happen. We're going to close this one, but it doesn't mean that it's not still valid. We've got some time yet before the move while we resolve pending Pull Requests, so if this issue is still relevant, please @ me and I'll make sure it gets transferred to the new repo. :beer: