Closed fregiese closed 4 years ago
Duplicate of #833, see also https://github.com/Polymer/lit-element/issues/883#issuecomment-577591359
As mentioned there, please make sure you are using babel.config.js
.
I am already using babel.config.js
, the config is in the description of the issue.
You probably need to update your preset-env
config to look like this:
[
"@babel/preset-env",
{
modules: false,
targets: {
ie: 11
}
}
],
I changed the babel.config.js
to:
module.exports = {
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: {
ie: 11,
},
},
],
],
plugins: [
[
'@babel/plugin-proposal-decorators',
{
legacy: true,
},
],
'@babel/plugin-proposal-class-properties',
[
'@babel/plugin-transform-runtime',
{
regenerator: true,
},
],
],
};
But IE11 sadly doesn't work, it gives me this error:
SCRIPT5007: Unable to set property 'wrap' of undefined or null reference
components.js (1,6277)
Thanks @web-padawan for helping here.
Unfortunately, I'm not a Webpack expert. @fregiese could you make a minimal reproduction in a github repo or zip file that I can try out? Since I'm not great with Webpack, it would be helpful to eliminate all unnecessary configuration like the Scss loaders, etc.
When working on a rollup config, I ran into issues with the ordering of the polyfills, as described by @LarsDenBakker in https://github.com/Polymer/lit-element/issues/833#issuecomment-548846702.
My fix, like the one shown in that issue, involved removing babel-plugin-transform-runtime (which inlines the polyfills) and instead creating a separate bundle for the Babel polyfills, and importing them before the webcomponents polyfills, as shown in https://github.com/Polymer/lit-element/issues/833#issuecomment-559493194.
Hope that helps. If you can't get it working after looking at that, please make a repro that we can try to debug as @justinfagnani said.
Closing based on the previous comments. Please re-open a new issue with more info if the problem persists.
For people who have the same problems, we now have a working configuration:
One of the main problems was, that the regex didn't work windows machines, we now have this regex, that works for mac and windows:
{
test: /\.js$/,
exclude: /[\\/]node_modules[\\/](?!(lit-element|lit-html)[\\/]).*/,
use: 'babel-loader',
},
Before the regex was updated, lit-element and lit-html was not compiled with babel, like it is supposed to as stated here: https://lit-element.polymer-project.org/guide/start under "Supporting older browsers"
babel.config.js
module.exports = {
presets: [
'@babel/preset-env',
],
plugins: [
[
'@babel/plugin-proposal-decorators',
{
legacy: true,
},
],
'@babel/plugin-proposal-class-properties',
[
'@babel/plugin-transform-runtime',
{
regenerator: true,
},
],
],
};
So the steps for us to get it working in IE11 was:
@webcomponents/webcomponentsjs
Polyfill@fregiese thanks for putting it together. My comments at https://github.com/Polymer/lit-element/issues/883#issuecomment-577591359 and https://github.com/Polymer/lit-element/issues/883#issuecomment-577651183 describe the same, but your comment looks cleaner and should be helpful for beginners.
@web-padawan Yes, I wanted to make a closing statement, because your comments helped me to get a working configuration. So I wanted to share it with other users who have trouble, are finding this issue and don't have a deep understanding of how it all works together. Thanks for the help!
You are a gem @fregiese , your suggestion worked straightforwardly . I was struggling a lot with this. May Thanks.
Problem
Currently IE11 ist not rendering our Web Components that we build with Lit-Elements. We don't get any errors in the IE11 Console, but Web Components are still not showing. We only have these Problems with IE11. Every other browser is showing all of our Web Components with no problems at all.
Structure
We load the polyfills in the head. After that we load our .js with all of our web components. All files are found and loaded in IE11.
We also normally have a
vendor.js
with bootstrap and jquery and so on, but we currently don't load the file to isolate the problem.babel.config.js
webpack.config.js
package.json
We have Storybook in our project, but currently we are only testing the output of
webpack --mode production
in a static html file.Acceptance criteria
IE11 must render the Web Components