-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(browser): build a dedicated version for the browser (#242)
* feat(browser): build a dedicated version for the browser BREAKING CHANGE: This PR change of the internal directory structure of the exported code. The previous code has move from the `dist/` into the `dist/esm` directory (but remender that we do not avice you to do use internals code 🤓) * fix(bunble): do not bundle peer dependencies * qa(ci): Avoid duplicate runs of checks on CI * qa(dependencies): Upgrade to latest rollup versions * qa(test): Allow to run the smoke tests aggaint all builded versions
- Loading branch information
1 parent
937a7e9
commit 574d850
Showing
8 changed files
with
724 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import fs from 'fs'; | ||
import babel from 'rollup-plugin-babel'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import flow from 'rollup-plugin-flow'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import builtins from 'rollup-plugin-node-builtins'; | ||
import globals from 'rollup-plugin-node-globals'; | ||
|
||
const extractPackagePeerDependencies = () => { | ||
const packageNpm = JSON.parse( | ||
fs.readFileSync('./package.json', { encoding: 'utf8' }) | ||
); | ||
|
||
return Object.keys(packageNpm.peerDependencies || {}); | ||
}; | ||
|
||
export default { | ||
input: 'src/index.js', | ||
output: { | ||
file: 'dist/cjs/index.js', | ||
format: 'cjs', | ||
sourcemap: true, | ||
}, | ||
external: extractPackagePeerDependencies(), | ||
plugins: [ | ||
babel({ | ||
babelrc: false, | ||
exclude: 'node_modules/**', // only transpile our source code | ||
presets: [ | ||
[ | ||
'es2015', | ||
{ | ||
modules: false, | ||
}, | ||
], | ||
'stage-2', | ||
'react', | ||
'flow', | ||
], | ||
plugins: ['external-helpers'], | ||
externalHelpers: true, | ||
}), | ||
resolve({ | ||
module: true, | ||
jsnext: true, | ||
main: true, | ||
browser: true, | ||
}), | ||
commonjs({ | ||
sourceMap: true, | ||
namedExports: { | ||
react: ['isValidElement'], | ||
}, | ||
}), | ||
globals(), | ||
builtins(), | ||
flow(), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.