meteor-svelte / svelte-es5-meteor Goto Github PK
View Code? Open in Web Editor NEWSvelte ES5 compatibility build for Meteor (deprecated)
Svelte ES5 compatibility build for Meteor (deprecated)
Svelte has this line in its dispatchObservers
function:
// src/shared/index.js
if ( newValue === oldValue && typeof newValue !== 'object' ) continue;
After compiling it to ES5 for package "svelte-es5-meteor" it becomes:
// dist/[email protected] line 14606
if (newValue === oldValue &&
(typeof newValue === 'undefined' ? 'undefined' : _typeof(newValue)) !== 'object')
continue;
Then, after Meteor's build system processes it I get an error saying _typeof is not defined
.
I checked through the source code it built using View Page Source and found Meteor is changing the use of typeof
. It grabs that from 'babel/runtime/typeof' and assigns it to _typeof3
and then does the ES5 interop (_interopRequireDefault
) thing to make a _typeof4
with a default property containing it. Then, the later code uses _typeof4.default
instead of typeof
.
Except, the "dispatchObservers" function still uses _typeof
, which doesn't exist. It was defined in svelte but didn't make it into the code sent to the browser.
I then changed the line in dist/svelte.js
to be the way the original src/shared/index.js
is. Reset the meteor project and started the app. Then the line looks like this:
if (newValue === oldValue &&
(typeof newValue === "undefined" ? "undefined" : (0, _typeof3.default)(newValue)) !== 'object')
continue;
It is now replacing the typeof
use with the _typeof3
variable Meteor put in there (which was _typeof4 previously). So, it works because that is defined.
It seems to me the transpiling for "svelte-es5-meteor" is changing that line in a way which prevents it from being changed later by Meteor when Meteor tries to replace the typeof
operations. Or, somehow it's failing to include a declaration creating _typeof
in the browser code.
Have you encountered this?
I'm not sure what the fix should be. Is it to avoid transpiling the line used in generating code? Or, ensure _typeof
is defined in the code sent to the browser?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.