-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Switch to rollup for library bundling (#49)
* Forced the bundle to use commonjs2 * fix: Configured the publish to allow import without the extension * fix: updated webpack config to solve issue with jest tests * fix: switched from webpack to using rollup for bundling
- Loading branch information
1 parent
0bdd655
commit 863a803
Showing
3 changed files
with
58 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,10 @@ | |
"description": "Blocjs is a minimal structural set of components built with Styled System", | ||
"author": "Team Pindo <[email protected]>", | ||
"license": "MIT", | ||
"main": "src/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "dist/index.js", | ||
"files": ["/dist"], | ||
"scripts": { | ||
"develop": "webpack --mode development --watch", | ||
"build": "webpack --mode production" | ||
"build": "rollup -c" | ||
}, | ||
"dependencies": { | ||
"@styled-system/css": "^5.1.5", | ||
|
@@ -19,18 +16,20 @@ | |
"devDependencies": { | ||
"@babel/core": "^7.10.2", | ||
"@babel/preset-env": "^7.10.2", | ||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | ||
"babel-loader": "^8.1.0", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.12", | ||
"webpack-node-externals": "^1.7.2", | ||
"@babel/preset-react": "^7.8.0", | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-peer-deps-external": "^2.2.0", | ||
"rollup-plugin-terser": "^5.1.2", | ||
"rollup-plugin-uglify": "^6.0.3", | ||
"styled-components": "^5.1.1" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.13.1", | ||
"styled-components": "^5.1.1" | ||
}, | ||
"repository": { | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/pindoio/blocjs.git" | ||
} | ||
|
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,45 @@ | ||
import babel from "rollup-plugin-babel"; | ||
import commonjs from "rollup-plugin-commonjs"; | ||
import resolve from "rollup-plugin-node-resolve"; | ||
import external from "rollup-plugin-peer-deps-external"; | ||
import { terser } from "rollup-plugin-terser"; | ||
|
||
import packageJSON from "./package.json"; | ||
const input = "./src/index.js"; | ||
const minifyExtension = pathToFile => pathToFile.replace(/\.js$/, ".min.js"); | ||
|
||
export default [ | ||
// CommonJS | ||
{ | ||
input, | ||
output: { | ||
file: packageJSON.main, | ||
format: "cjs" | ||
}, | ||
|
||
plugins: [ | ||
babel({ | ||
exclude: "node_modules/**" | ||
}), | ||
external(), | ||
resolve(), | ||
commonjs() | ||
] | ||
}, | ||
{ | ||
input, | ||
output: { | ||
file: minifyExtension(packageJSON.main), | ||
format: "cjs" | ||
}, | ||
plugins: [ | ||
babel({ | ||
exclude: "node_modules/**" | ||
}), | ||
external(), | ||
resolve(), | ||
commonjs(), | ||
terser() | ||
] | ||
} | ||
]; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { default as Box } from "./box"; | ||
export { default as Bloc } from "./bloc"; | ||
export { default as Flex } from "./flex"; | ||
export { default as Bloc } from "./bloc"; |