Skip to content

Commit

Permalink
-Added ESM support
Browse files Browse the repository at this point in the history
-Added rollup as a bundler
-Modified babelrc to avoid unnecessary transpilation
  • Loading branch information
kamleshchandnani committed Dec 21, 2017
1 parent cf54537 commit 2032b4d
Show file tree
Hide file tree
Showing 17 changed files with 1,965 additions and 8,070 deletions.
30 changes: 20 additions & 10 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
{
"presets": [
[
"env",
{
"modules": false
}
],
"react",
"stage-1"
]
"env": {
"es": {
"presets": [
[
"kamlesh",
{
"targets": {
"browsers": ["last 2 Chrome versions", "safari >=11"]
},
"loose": false,
"modules": false,
"useBuiltIns": false
}
]
]
},
"cjs": {
"presets": [["kamlesh"]]
}
}
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public
dist
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "eslint-config-kamlesh",
"parser": "babel-eslint"
}
174 changes: 0 additions & 174 deletions .eslintrc.json

This file was deleted.

8 changes: 7 additions & 1 deletion config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ module.exports = {
path: paths.appBuild,
filename: "index.js",
publicPath: "/",
libraryTarget: "umd"
// library: "react-chunkable",
library: {
root: "react-chunkable-root",
amd: "react-chunkable-amd",
commonjs: "react-chunkable"
},
libraryTarget: "cjs"
},
module: {
rules: [
Expand Down
1 change: 1 addition & 0 deletions dist/index.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions examples/bundle-summary.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$total": "506.3K",
"js/bundle.79e40ac4.js": "114.7K",
"js/home.d11d55d1.js": "46.2K",
"js/profile.59761aa5.js": "66.6K",
"js/runtime.b5ae610d.js": "1.5K",
"js/vendor.bundle-defc95a9.js": "277.2K"
"$total": "416.1K",
"js/bundle.842440fb.js": "342.9K",
"js/commonlazy.js-bundle.91e9b85f.js": "43.2K",
"js/home.c958c68d.js": "3.2K",
"js/profile.bcfca890.js": "25.3K",
"js/runtime.b257121d.js": "1.5K"
}
26 changes: 14 additions & 12 deletions examples/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const BundleSummary = require("webpack-bundle-summary");
const DashboardPlugin = require("webpack-dashboard/plugin");
const baseConfig = require("./webpack.config.base");
const paths = require("./paths");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;

const devTools = "cheap-module-source-map";

Expand All @@ -26,7 +27,7 @@ const postCSSLoader = {
}
};
const plugins = [
// new BundleAnalyzerPlugin(),
new BundleAnalyzerPlugin(),
new DashboardPlugin(),
new BundleSummary(),
new ProgressBarPlugin(),
Expand Down Expand Up @@ -60,18 +61,19 @@ const plugins = [
sourceMap:
devTools && (devTools.indexOf("sourcemap") >= 0 || devTools.indexOf("source-map") >= 0)
}),
new webpack.optimize.OccurrenceOrderPlugin(),
// new webpack.optimize.OccurrenceOrderPlugin(),
// new webpack.optimize.AggressiveMergingPlugin(),
// new webpack.optimize.CommonsChunkPlugin({
// name: "vendor",
// // if omitted default value is 3
// minChunks: Infinity,
// filename: "js/vendor.bundle-[chunkhash:8].js"
// }),
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
// if omitted default value is 3
minChunks: 3,
filename: "js/vendor.bundle-[chunkhash:8].js"
}),
new webpack.optimize.CommonsChunkPlugin({
async: true,
async: "commonlazy.js",
children: true,
minChunks: 3
minChunks: 2
// filename: "js/commonlazy-[chunkhash:8].js"
}),
new webpack.optimize.CommonsChunkPlugin({
name: "runtime"
Expand Down Expand Up @@ -116,8 +118,8 @@ module.exports = {
devtool: devTools,
context: baseConfig.context,
entry: {
bundle: appEntry,
vendor: baseConfig.entry.vendor
bundle: appEntry
// vendor: baseConfig.entry.vendor
},
output: {
path: paths.appBuild,
Expand Down
Loading

0 comments on commit 2032b4d

Please sign in to comment.