Skip to content
This repository has been archived by the owner on Aug 5, 2019. It is now read-only.

Provide esm output #2

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 0 additions & 20 deletions .babelrc

This file was deleted.

22 changes: 22 additions & 0 deletions .babelrc.js
@@ -0,0 +1,22 @@
module.exports = {
presets: [
["@babel/env", {
modules: process.env.NODE_ENV.includes('cjs') ||
process.env.NODE_ENV === 'test'
? 'commonjs'
: false
}],
"@babel/react"
],
plugins: []
}

if (process.env.NODE_ENV.includes('emotion')) {
Copy link
Member

Choose a reason for hiding this comment

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

This could still be handled with the env field right? Sorry haven't had time to dig into some of the Babel 7 changes yet

Copy link
Author

Choose a reason for hiding this comment

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

env field works only with json config. I use js here to achieve some logic.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I haven't seen anything about the env field being deprecated in Babel 7 – if you happen to have a link to the docs that'd be helpful

Copy link
Author

Choose a reason for hiding this comment

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

It's not deprecated (well, it was for a while).

env field just not used by js config. Consider json version with env field is a wrapper around it. Don't know where this mentioned in docs to be honest.

module.exports.plugins.push([
'transform-rename-import',
{
original: 'styled-components',
replacement: 'react-emotion'
}
])
}
2 changes: 2 additions & 0 deletions emotion.mjs
@@ -0,0 +1,2 @@
export * from './dist/emotion';
export { default } from './dist/emotion';