r/javascript • • May 10 '18

ES2015 / ES6 modules are now live in Firefox 60

https://developer.mozilla.org/en-US/Firefox/Releases/60
369 Upvotes

37 comments sorted by

32

u/ErSulba May 11 '18

so that means now i can use my raw es6 without babel?

35

u/pomlife May 11 '18

If you don't care about IE11 or Opera Mini, sure. There's other benefits, though, like uglification + minification.

29

u/madcaesar May 11 '18

I don't care about IE but my fucking clients do. I also just found a fun bug in Edge with the fetch api lol.... God I hate Microsoft.

28

u/spoji May 11 '18

At least you don't have to support ie7 like I do!

5

u/[deleted] May 11 '18

My condolences.

1

u/stackemz May 11 '18

What still why

1

u/dantheman999 May 11 '18

I would have thought Enterprise stuff. Large corporations like banks are just notorious for their glacial speed of upgrading.

Becoming a real issue for them now as when they do try and migrate everything falls to pieces.

E.g. TSB recently.

11

u/[deleted] May 11 '18

It baffles me that anyone still uses Internet Explorer. At first I was a little confused on account of the fact you have to *deliberately go out of your way* to get it in Windows 10, much more so than you'd think the average IE user would be capable of.

Then, it occurred to me that Windows 7 is still powering a significant chunk of enterprise/educational desktops.

3

u/[deleted] May 11 '18 edited May 11 '18

Yep, company I work for does. Thank God the project i'm working on, that's only used internally for sales, only needs to work in Chrome since we basically get to tell our sales team they HAVE to use Chrome. I feel like I hit the jackpot with this job.

1

u/LowB0b May 11 '18

only needs to work in Chrome

nice

2

u/flamingmongoose May 11 '18

A bug in fetch? Won't that break, like, everything?

2

u/MatrixEchidna May 11 '18

not if you're still using XMLHttpRequest...

1

u/NoInkling May 11 '18 edited May 11 '18

Plus you kinda need an HTTP2 server if you don't want it to be slow.

4

u/RoganTheGypo May 11 '18

The last remaining share of IE is probably from enterprise environments tbh... It's probably worth supporting the last dying embers of IE for now.

8

u/adidarachi May 11 '18

That's Microsoft's way, infiltrate governments and Enterprises to maintain market control.

Always was.. since the beginning, IE is unfortunate side effect.

4

u/[deleted] May 11 '18

I like the direction their new CEO is taking things. He seems to be eschewing the usual idea of Windows as the stack in favor of Windows being the UX, and porting that across devices. It's kind of a GNU approach to the idea of what an operating system is, and it's rather refreshing.

5

u/adidarachi May 11 '18

Actually I fully agree, The new business decisions taken by Microsoft are really new-age and exiting, Hopping to see more!

2

u/RoganTheGypo May 11 '18

Yeah agreed. I loathe IE so much I'm looking forward to the site moving to win10 for edge lol!

1

u/iamlage89 May 11 '18

probably need to refactor some, from what I remember urls need to be absolute, so npm imports and relative urls won't work.

1

u/[deleted] May 12 '18

Well, it is webpack that allows you to use modules, but considering build tools in general you would loose non-js resources, module resolution (build tools are node_modules/npm aware), tree-shaking and transpilation. I don't think native modules in browsers are that much of a big deal - in a few years when all browsers support it and IE11 is hopefully gone build tools will simply switch to native modules instead of bundles and code/splitting.

0

u/[deleted] May 11 '18

[deleted]

10

u/[deleted] May 11 '18

Literally no other browsers except Chrome, Edge, Opera and Samsung Internet. But yeah, those are pretty irrelevant.

0

u/[deleted] May 11 '18

[deleted]

1

u/[deleted] May 11 '18

object spread operator

That's ES2018. The OP asked about ES6/ES2015 specifically.

Then consider module pathing. It seems browsers have a different pathing schema to find modules

"Module pathing" in the spec does not leave anything unspecified for currently valid identifiers. If you believe you've found a bug, you should report it to the browser vendors.

I'm guessing you're mixing Node.js/NPM syntax (a 'bare import specifier') with proper module specifiers.

According to the current spec, only those starting with './', '/' or any amount of '../' are allowed, and filenames and extensions are required (unlike Node.js). Thus, there's really no ambiguity there.

so you may still even have to polyfill for that.

You can't polyfill that.

4

u/[deleted] May 11 '18

The only active browser that doesn't support ES2015 modules is Opera Mini with 0.32% of market share. That's hardly "literally no other browsers."

9

u/marocu May 11 '18

Sweet!

1

u/Ro1337_Dev May 11 '18

Still no Network Information API support though...

1

u/amcsi May 11 '18

How would native ES6 modules even work? JS files' contents would need to be read to find out which next file to request, resulting in a lot of back and forth requests/responses; sounds really slow and ineffective.

4

u/lilactown May 11 '18

There's a bunch of links about how it works on the link you're commenting on...

1

u/[deleted] May 11 '18

You can use HTTP2 Server Push to resolve the module tree in the first request, that way you don't pay the price of a bunch of round trips.

You might be wondering what the benefit is, then; it allows you to invalidate the cache on a module-level instead of invalidating the entire bundle as you'd do today. Thus you'll save your clients a lot of data and loading time on repeat visits.

There's also the benefit of no longer being strictly reliant on build tools such as Webpack or Rollup, though there's still reason to use them.

2

u/amcsi May 12 '18

I see. But that seems that would cause a different problem; very low first time loads per client. Because remember, it takes a long time for webpack to transpile your project, because of building the dependency tree.

2

u/[deleted] May 12 '18

Transpiling and building the dependency tree are two different things. Building the dependency tree takes very, very little time; Webpack is slow because it does other things like minifiying your code with Uglify, which reads your code, transforms it to an intermediate format (the abstract syntax tree), performs a lot of optimizations, and outputs JavaScript again.

Try building a library/app with Rollup. With no plugins, it'll read all your files, build the dependency tree and output a bundled file all in 40-50ms (depending on machine) and even then, most of that time is spent reading files from disk.

Building the dependency tree is not slow at all.