akanix42 / meteor-css-modules

MIT License
92 stars 20 forks source link

Proxy constructor problem #118

Closed csKangGdcomm closed 6 years ago

csKangGdcomm commented 6 years ago

Hi,

Thanx for the awesome project!

I have a problem related to the Proxy object.

I am using your project and scss together and.

When i tried to load my project on android device is 4.2.2 android version, pretty old,

there is an error after build success.

meteor run android-device

// the file is located at .meteor/local/build/programs/web.cordova/app/app.js

"styles.scss.js":function(require,exports,module){

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                               //
// client/styles.scss.js                                                                                         //
//                                                                                                               //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                 //
var module1 = module;
module1.export({
"default": function () {
return styles;
},
styles: function () {
return styles;
}
});
var styles = new Proxy({ /////////// ERROR IS HERE!!!! ////////////////
"container": "_client__styles__container"
}, {
get: function (target, name) {
return name in target ? target[name] : console.warn(name, ': CSS module class not found in client/styles.scss');
}
});
exports.__esModule = true;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

the message is below

android:http://localhost:12104/app/app.js:1664) Uncaught ReferenceError: Proxy is not defined

I tried to add proxy-polyfill ( https://github.com/GoogleChrome/proxy-polyfill )

but I am not sure I added the polyfill well

Anyway it faills, It shows the error still now.

Can you give me some advice? Thank you!

egemon commented 6 years ago

The same issue in development mode for IE11. Still when building with circleCI I managed somehow avoid this in staging, but when trying to deploy locally - getting the same error. That is why, I think here some build issue, and should exist more elegant solution than adding the polyfill.

So basically we can see it here https://github.com/nathantreid/meteor-css-modules/commit/5f725828ac6707dc7b55ee478696de5fd093381a#diff-8ba28762823f7ae358cd86b415271a6eR246

TEMP SOLUTION: So I was able to solve my issue with adding to package.json

"cssModules": {
    "missingClassErrorLevel": false,
...
  }

NOT WORKING:

I can't find more elegant solution

NODE_ENV=production meteor run --settings development-settings.json

and

meteor run --settings development-settings.json --production

Are not working. Strange.

@csKangGdcomm FYI

csKangGdcomm commented 6 years ago

I solve this problem. you can check Meteor Forum The main problem is that Meteor should provide elegant way to include some code or library when user build their project or develop their project. Anyway I hope I can help you @egemon if you faced this problem Thank you! I will closed this issue.

akanix42 commented 6 years ago

I noticed the issue where running in --production mode still produces the Proxy. I believe it is a caching bug in my code as after a meteor reset, running in --production mode did not produce the Proxy.