Skip to content

Conversation

@dmiller9911
Copy link
Contributor

@dmiller9911 dmiller9911 commented Mar 29, 2018

  • Added .babelrcjs to be used by .babelrc.
  • Added script to build components with ES modules and output to dist/esm.
  • Added modules property in package.json to point to new esm directory.

What:
Now exporting ES Modules in addition to the CommonJS modules we currently export. This does not currently fix treeshaking for webpack 3, but it puts us on the right track. Since we use export * syntax at the base webpack cannot treeshake this project, I added sideEffects fals to the project.json. This will allow any consumer that is using webpack 4 to treeshake patternfly-react.

Link to Storybook:
N/A

Additional issues:
N/A

@coveralls
Copy link

coveralls commented Mar 29, 2018

Pull Request Test Coverage Report for Build 1085

  • 0 of 0 (NaN%) changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 71.663%

Totals Coverage Status
Change from base Build 1043: 0.0%
Covered Lines: 1256
Relevant Lines: 1585

💛 - Coveralls

@dmiller9911 dmiller9911 force-pushed the build-ExportESModules branch 2 times, most recently from 15d3d93 to 9f31986 Compare March 29, 2018 15:49
Added .babelrcjs to be used by .babelrc.  Added script to build components with ES modules and
output to dist/esm.  Added modules property in package.json to point to new esm directory.
@dmiller9911 dmiller9911 force-pushed the build-ExportESModules branch from 9f31986 to 6084edf Compare March 29, 2018 17:54
"commit": "git-cz",
"build": "npm run build:scripts && npm run build:sass && npm run build:less",
"build:scripts": "babel src --out-dir dist/js --ignore .test.js,__mocks__",
"build:scripts": "concurrently \"npm run build:cjs\" \"npm run build:esm\"",
Copy link
Member

Choose a reason for hiding this comment

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

nice use of concurrently ;) ⭐️

@priley86
Copy link
Member

priley86 commented Apr 2, 2018

this is great 👏

can you add support for webassembly/experimental next? 😆
https://medium.com/webpack/webpack-4-released-today-6cdb994702d4

it looks like we will have full ESM module support in NodeJS very soon as well?
https://twitter.com/seldo/status/952220966398001152
https://gist.github.com/ceejbot/b49f8789b2ab6b09548ccb72813a1054#esmcjs-interoperability-in-nodejs

it would also be fun to experiment w/ configless webpack / npm asset in the future...
https://twitter.com/seldo/status/952222961817214981

@priley86
Copy link
Member

priley86 commented Apr 9, 2018

conflicts in package.json now... should we wait for the monorepo to introduce this now? I'm fine either way...no rush here.

@dmiller9911
Copy link
Contributor Author

Ummmmm. Honestly might as well. Going to close it in favor of that. If monorepo gets pushed too far out we can revisit this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants