Skip to content
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.

[do not merge] Update redux; remove window.process #249

Closed
wants to merge 1 commit into from

Conversation

keanulee
Copy link
Contributor

@keanulee keanulee commented Oct 15, 2018

Can finally remove the window.process = hack.

Do not merge until polymer build handles .mjs files.

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!! It just works 🎉

@abdonrd
Copy link
Contributor

abdonrd commented Oct 15, 2018

@TimvdLippe how do you build the project if the Polymer tools doesn't support .mjs?

@TimvdLippe
Copy link
Contributor

TimvdLippe commented Oct 15, 2018 via email

@keanulee
Copy link
Contributor Author

Thinking more about this, I'm really not a fan of specifying the path of an import. Consider this change:

import {
  createStore,
  compose,
  applyMiddleware,
  combineReducers	
} from 'redux/es/redux.mjs'; // previously: from 'redux'

The package.json for redux does not contain the field that points to this "browser-compatible module" build ("module": "es/redux.js" uses process.env and isn't browser-compatible), so we are forced to write out the path because our tools wouldn't otherwise know where to find this build. This forces the library vendor to preserve the file path of this build across non-breaking releases. Moreover, if using TypeScript, the definitions for these functions would no longer work (since typings rely on pkg.typings).

Separately, it's weird that the "browser-compatible module" build uses the .mjs extension since this file extension was originally created so that server Node.js code could distinguish modules (the browser already knows it's a module through the <script type=module> attribute).

It's worth thinking about whether we should introduce a new package.json field for the main "browser-compatible module" build. Alternatively, we should consider removing non-browser things (like process.env) from the main pkg.module build.

@keanulee keanulee closed this Oct 24, 2018
@keanulee keanulee deleted the no-process branch October 24, 2018 18:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants