Skip to content
This repository has been archived by the owner on Dec 25, 2021. It is now read-only.

Commit

Permalink
fix(bundle): fix the broken bundles
Browse files Browse the repository at this point in the history
change the build step to stop compilation for newer features except modules
  • Loading branch information
alivenotions committed Dec 12, 2019
1 parent 7396f59 commit b8fe4ef
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 138 deletions.
9 changes: 1 addition & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
{
"env": {
"production": {
"presets": ["@babel/preset-env"]
},
"test": {
"plugins": ["@babel/plugin-transform-modules-commonjs"]
}
}
"plugins": ["@babel/plugin-transform-modules-commonjs"]
}
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "NODE_ENV=production npm-run-all build:*",
"build:main": "babel src --out-dir dist --ignore src/*.test.js",
"build:main": "copyfiles -f src/* dist -e src/*.test.js",
"build:min": "terser src/index.js src/poll.js -m -c -o dist/poll.min.js",
"build:umd": "webpack --output-filename poll.umd.js -d",
"build:umd.min": "webpack --output-filename poll.umd.min.js -p",
"commit": "git cz",
Expand All @@ -32,17 +33,16 @@
"delay"
],
"files": [
"dist",
"dist/*.js",
"README.md",
"example"
],
"homepage": "https://github.com/alivenotions/simple-poll#readme",
"devDependencies": {
"@babel/cli": "7.1.5",
"@babel/plugin-transform-modules-commonjs": "7.7.5",
"@babel/preset-env": "7.1.5",
"babel-loader": "8.0.4",
"commitizen": "3.0.5",
"copyfiles": "2.1.1",
"cz-conventional-changelog": "2.1.0",
"jest": "24.9.0",
"node-fetch": "2.2.0",
Expand All @@ -51,6 +51,8 @@
"rimraf": "2.6.2",
"semantic-release": "^15.11.0",
"sinon": "7.1.1",
"terser": "4.4.2",
"terser-webpack-plugin": "2.2.3",
"travis-deploy-once": "^5.0.9",
"webpack": "4.25.1",
"webpack-cli": "3.1.2"
Expand Down
8 changes: 8 additions & 0 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { join } from 'path'
import TerserPlugin from 'terser-webpack-plugin'

const include = join(__dirname, 'src')

Expand All @@ -9,13 +10,20 @@ export default {
libraryTarget: 'umd',
library: 'simplePoll',
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
plugins: ['@babel/plugin-transform-modules-commonjs'],
},
}
}
]
Expand Down
Loading

0 comments on commit b8fe4ef

Please sign in to comment.