Comments (17)
Yep! jeffijoe/awilix#286
from es5-shim.
Let me build an example and get back to you.
from es5-shim.
https://github.com/sobrinho/es5-shim-480
You can run yarn run serve
and access localhost:8080
and open the inspector.
If you remove the es5-shim from the public/index.html, it works just fine.
It is all standard files generated by npx @vue-cli create example
and selected Vue2 and JS, added awilix, created a dummy container and then added es5-shim.
I don't think it is related to the Vue or Awilix itself, it is about something that Awilix is doing and Babel is trying to compile.
from es5-shim.
Note that this app crashes immediately in Safari, because Error.captureStackTrace
is a nonstandard chrome-only API.
I can definitely reproduce this in Chrome, and will continue to look into the error. It's also possible it's coming from webpack 5, and I've asked them about it as well.
from es5-shim.
Looks like jeffijoe/awilix#287 will fix it, so I'll close this :-)
from es5-shim.
from es5-shim.
Pinned the issue to spreading an object that without es5-shim does work.
from es5-shim.
Hmm - the “could not resolve” error doesn’t seem like it’s coming from es5-shim. What are you using to transpile object spread?
from es5-shim.
The app was created with vue-cli. What info do you need?
from es5-shim.
I'm not familiar with vue projects. Do you get that error when running eslint, or when bundling (with webpack, i presume?), or at runtime?
from es5-shim.
ok, so there's a few issues. For one, you're using an out of date version of es5-shim, plus you're pulling it off a CDN instead of bundling it.
Second, the app is already using core-js, and while core-js should work fine in concert with es-shims, you shouldn't need both - i believe core-js provides everything es5-shim does.
Third, es5-shim isn't meant to be used alone; it's meant to be used in concert with the es6-shim - but adding that to the HTML file doesn't fix it.
The actual problem is caused by something doing require(Symbol.toStringTag)
, but i'm not sure why it would be doing that. The exception is thrown when __webpack_require__
is called, trying to load babel-loader
. I'm also not sure why babel would be running in the browser at all - but awilix is requiring it, it seems (i'd file an issue about that; babel's not meant to be used in the browser).
I suspect the problem is that one of the methods es5-shim patches is producing a Symbol, and some code inside babel-loader - or that babel-loader is processing - may not be expecting that.
from es5-shim.
This is a reduction of the eval'd code inside the webpack bundle that's throwing:
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _pwd_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ \"./node_modules/@babel/runtime/helpers/esm/objectSpread2.js\");
/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");
/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var awilix__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! awilix */ \"./node_modules/awilix/lib/awilix.browser.js\");
var container = (0,awilix__WEBPACK_IMPORTED_MODULE_2__.createContainer)();
container.register({
container: (0,awilix__WEBPACK_IMPORTED_MODULE_2__.asValue)(\"dummy\")
});
var cradle = container.cradle;
var expanded = (0,_pwd_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, cradle);
console.log(Object.keys(cradle));
console.log(Object.keys(expanded));
/* harmony default export */ __webpack_exports__[\"default\"] = ({
name: 'HelloWorld',
props: {
msg: String
}
});//# sourceURL=[module]
which strongly suggests it's something inside awilix that's throwing the error. Given that its purpose is to do dynamic DI (an unidiomatic thing in JS), this would be unsurprising.
from es5-shim.
Third, es5-shim isn't meant to be used alone; it's meant to be used in concert with the es6-shim - but adding that to the HTML file doesn't fix it.
The problem is that we don't control where our widget is used.
So, a customer have the es5-shim in their website and the widget does not work there.
from es5-shim.
thanks, that's useful context. the customer is the one using awilix?
from es5-shim.
Nope, I am the one using it. The customer is the one using es5-shim in their website.
from es5-shim.
Have you filed this with awilix? Their code looks pretty complex, so they can probably find their dynamic requires faster than i can.
from es5-shim.
from es5-shim.
Related Issues (20)
- All V8 versions have the Date shim loaded. HOT 1
- Rounding errors with toExponential in Edge 15/16 HOT 4
- IE9 error: Redeclaration of const property HOT 5
- Something in the shim causes Chrome to throw a warning HOT 3
- 4.5.11 got a tag, but not a full release HOT 2
- `hasAutomationEqualityBug` triggers deprecation warnings in Firefox
- Cannot convert undefined or null to object PropTypes.shape() HOT 9
- Question: Why concatenate Symbols with a string without assigning it to a variable? HOT 6
- Why not set bound.prototype = target.prototype directly? HOT 3
- in ie8 Object.keys failed this conversion HOT 3
- Action required: Greenkeeper could not be activated 🚨
- String#lastIndexOf has a shallow-wrapper shim that does nothing and always gets applied HOT 1
- Dependency Dashboard
- Conflict ES5-shim(sham) 4.5.15 and ES6-shim(sham) 0.35.x HOT 19
- Please change the name of the default branch HOT 1
- External URL linking to spam websites HOT 2
- errors with Object.defineProperty under ie8 since 4.6.3 HOT 6
- Invalid Date on Safari HOT 2
- ⚠️ `webkitStorageInfo` is going away HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from es5-shim.