Comments (10)
@camargo If I understand this correctly, you are having this issue for web-animations Polyfill? One way to deal with this would be to exclude it from your bundle. This might also be better for performance of your site, because your users might already have web-animations cached in their browsers, so it can be served from cache (not possible when it is included in your bundle).
Just remove any references to web-animations from any source files included in your bundle. Then add the reference to web-animations to a <script>
tag in your index.html.
from wc-loader.
Ps: After temporarily removing app-localize-behavior from my application, I received a similar issue from another library (same setup: a dependency Polymer component links an external lib js file). So the problem does not seem to be limited to AppLocalizeBehavior.
from wc-loader.
Digging deeper, this might be caused by intl-messageformat defining an IIFE that is called like this:
(function() {
// code here
}).call(this);
After running through wc-loader, this comes out as:
(function() {
// code here
}).call(undefined);
from wc-loader.
Just to confirm this seems to be the root cause, I found that paper-menu-button relies on (dependency chain following): iron-dropdown -> opaque-animation -> web-animations -> web-animations-next-lite.min.js.
web-animations-next-lite.min.js raises a related issue: Uncaught TypeError: Cannot set property 'true' of undefined
. The reason seems to be that web-animations-next-lite.min.js defines a function which is immediately invoked at the very end of the file:
function(a,b){/* ... */}({},function(){return this}())
Here, this
is supposed to be window
, but is undefined
in the context of the wc-loader-bundled webpack file.
from wc-loader.
Update: this is likely caused by external files (those in bower_components or node_modules) being run through babel-loader. Without applying babel-loader to these files, it seems to work fine. I need to work a little more on that, but if this can be confirmed, this issue can be closed.
from wc-loader.
This issue was due to external dependencies being babelified. This issue can be closed. If you're stumbling upon the same issue - this is how I solved it:
webpack.config.js
/* ... */
module: {
rules: [{
test: /\.html$/,
use: [
'babel-loader?presets[]=es2015',
'wc-loader'
],
exclude: /(node_modules|bower_components)/
}, {
test: /\.html$/,
use: 'wc-loader',
include: /(node_modules|bower_components)/
}, { /* ... */ }],
},
/* ... */
from wc-loader.
@emrass This is still an issue for me even after the workaround you mentioned. Do you have any other ideas on how to fix this? Thanks.
from wc-loader.
@camargo Could you post the relevant part of your webpack.config and the error message you get in the console? I'll have a look at it to see if there are any similarities to my case.
from wc-loader.
@emrass The console is giving: Uncaught TypeError: Cannot set property 'true' of undefined
. It is the same issue you discussed in this thread. It is also being discussed here: web-animations/web-animations-js#45.
from wc-loader.
@emrass This worked like a charm. Thank you for your help.
from wc-loader.
Related Issues (20)
- Use polymer-analyzer
- sourcemaps and breakpoints in IDE impossible? HOT 2
- Does not support quotes in urls in css
- ES6 transpiling + WC loader not working HOT 1
- Code is generated to load whitespace HOT 2
- minify html option HOT 1
- How to use lib when importing in index.html with HtmlWebpackPlugin HOT 1
- Tries to access publicPath of undefined HOT 1
- Externally hosted web components? HOT 2
- Child combinator in CSS is replaced with > HOT 6
- Creating extra <dom-module> element HOT 1
- ModuleNotFoundError with css external assets. How to handle css assets? HOT 7
- Loader fails? HOT 2
- Loader fails to compile polymer.html HOT 2
- Support for <link rel="stylesheet"> with an SCSS target
- Unbundled dev mode with wc-loader
- Support for webpack@4 HOT 1
- Write tests HOT 2
- import behaviors looks incorrect HOT 7
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 wc-loader.