Skip to content

Commit

Permalink
Merge pull request #11 from rstacruz/feature/deprecate-mjs-extension
Browse files Browse the repository at this point in the history
Fix Webpacker compatibility
  • Loading branch information
rstacruz authored Apr 21, 2019
2 parents 69bdbb8 + 568a1dd commit c7e5534
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
## Pre-v1.0.0 changes
## [v0.10.0]

> Apr 22, 2019
- Add a workaround for React elements in Shadow DOM mode. ([#8], [@rybon])
- Fix compatibility with Webpacker by making the main export `.js` instead of `.mjs`. ([#11])
- Deprecate importing using `import remount from 'remount/esm'` - just use `'remount'` instead. ([#11])

[#8]: https://github.com/rstacruz/remount/pull/8
[#11]: https://github.com/rstacruz/remount/pull/11
[@rybon]: https://github.com/rybon
[v0.10.0]: https://github.com/rstacruz/remount/compare/v0.9.5...v0.10.0

## v0.1 to v0.9

[v0.9.5]

Expand Down
14 changes: 6 additions & 8 deletions docs/builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Remount comes in 3 flavors:

| Version | Description |
| ------------- | ------------------------------------- |
| `remount/es5` | Supports legacy browsers (default) |
| `remount` | ES Modules build - the default |
| `remount/es5` | CommonJS build |
| `remount/es6` | Uses classes and other ES2015+ syntax |
| `remount/esm` | es modules .mjs build |

## Using builds

You can use them like so:
If you'd like to use an alternate build, you can import from it like so:

```js
import { define } from 'remount/es6'
import { define } from 'remount/es5'
```

Or if you're using Webpack:
Expand All @@ -24,7 +24,7 @@ module.exports = {
/* ... */
resolve: {
alias: {
remount: 'remount/es6'
remount: 'remount/es5'
}
}
}
Expand All @@ -35,7 +35,5 @@ module.exports = {
When used like so, Remount will be available as `window.Remount`. Great for using in JSFiddle/Codepen.

```js
<script src='https://cdn.jsdelivr.net/npm/remount'></script>
<script src='https://cdn.jsdelivr.net/npm/remount/dist/remount.es6.js'></script>
<script src='https://cdn.jsdelivr.net/npm/remount/dist/remount.esm.js'></script>
<script src='https://cdn.jsdelivr.net/npm/remount/dist/remount.es5.js' />
```
1 change: 0 additions & 1 deletion esm.mjs

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dist/remount.*",
"es5.js",
"es6.js",
"esm.mjs"
"esm.js"
],
"homepage": "https://github.com/rstacruz/remount#readme",
"jest": {
Expand All @@ -62,7 +62,7 @@
],
"license": "MIT",
"main": "dist/remount.es5.js",
"module": "dist/remount.esm.mjs",
"module": "dist/remount.js",
"peerDependencies": {
"react": ">= 15.0.0",
"react-dom": ">= 15.0.0"
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export default [
// ES Modules
{
...DEFAULTS,
output: { file: 'dist/remount.esm.mjs', format: 'esm' }
output: { file: 'dist/remount.js', format: 'esm' }
},

{
...DEFAULTS,
plugins: [MINIFY],
output: { file: 'dist/remount.esm.min.mjs', format: 'esm' }
output: { file: 'dist/remount.min.js', format: 'esm' }
},

// ES6
Expand Down

0 comments on commit c7e5534

Please sign in to comment.