mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Migrates to Webpack 4
This commit is contained in:
committed by
Zeno Rocha
parent
3382ea3d14
commit
5ef3f1a817
3
.babelrc
3
.babelrc
@@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"presets": ["es2015"],
|
"presets": ["env"]
|
||||||
"plugins": ["transform-es2015-modules-umd"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@ lib
|
|||||||
npm-debug.log
|
npm-debug.log
|
||||||
bower_components
|
bower_components
|
||||||
node_modules
|
node_modules
|
||||||
|
yarn-error.log
|
||||||
|
yarn.lock
|
||||||
|
|||||||
898
dist/clipboard.js
vendored
898
dist/clipboard.js
vendored
File diff suppressed because one or more lines are too long
8
dist/clipboard.min.js
vendored
8
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
25
package.json
25
package.json
@@ -17,11 +17,10 @@
|
|||||||
"tiny-emitter": "^2.0.0"
|
"tiny-emitter": "^2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "^6.5.1",
|
"babel-cli": "^6.26.0",
|
||||||
"babel-core": "^6.5.2",
|
"babel-core": "^6.26.0",
|
||||||
"babel-loader": "^6.2.10",
|
"babel-loader": "^7.1.4",
|
||||||
"babel-plugin-transform-es2015-modules-umd": "^6.5.0",
|
"babel-preset-env": "^1.6.1",
|
||||||
"babel-preset-es2015": "^6.5.0",
|
|
||||||
"chai": "^3.4.1",
|
"chai": "^3.4.1",
|
||||||
"cross-env": "^3.1.4",
|
"cross-env": "^3.1.4",
|
||||||
"karma": "^1.3.0",
|
"karma": "^1.3.0",
|
||||||
@@ -33,14 +32,22 @@
|
|||||||
"mocha": "^3.1.2",
|
"mocha": "^3.1.2",
|
||||||
"phantomjs-prebuilt": "^2.1.4",
|
"phantomjs-prebuilt": "^2.1.4",
|
||||||
"sinon": "^1.17.2",
|
"sinon": "^1.17.2",
|
||||||
"webpack": "^2.2.1"
|
"uglifyjs-webpack-plugin": "^1.2.4",
|
||||||
|
"webpack": "^4.5.0",
|
||||||
|
"webpack-bundle-analyzer": "^2.11.1",
|
||||||
|
"webpack-cli": "^2.0.14"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run build-debug && npm run build-min",
|
"build": "npm run build-debug && npm run build-min",
|
||||||
"build-debug": "webpack",
|
"build-debug": "webpack --mode=development",
|
||||||
"build-min": "cross-env NODE_ENV=production webpack --optimize-minimize",
|
"build-analyze": "cross-env ANALYZE_BUILD=true npm run prepublish",
|
||||||
|
"build-min": "cross-env NODE_ENV=production webpack --mode=production",
|
||||||
"build-watch": "webpack --watch",
|
"build-watch": "webpack --watch",
|
||||||
"test": "karma start --single-run",
|
"test": "karma start --single-run",
|
||||||
"prepublish": "npm run build"
|
"prepublish": "npm run build"
|
||||||
}
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
const pkg = require('./package.json');
|
const pkg = require('./package.json');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||||
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||||
|
|
||||||
const production = process.env.NODE_ENV === 'production' || false;
|
const production = process.env.NODE_ENV === 'production' || false;
|
||||||
|
|
||||||
@@ -22,20 +24,27 @@ module.exports = {
|
|||||||
{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}
|
{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
minimizer: [
|
||||||
|
new UglifyJSPlugin({
|
||||||
|
parallel: require('os').cpus().length,
|
||||||
|
uglifyOptions: {
|
||||||
|
ie8: false,
|
||||||
|
keep_fnames: false,
|
||||||
|
output: {
|
||||||
|
beautify: false,
|
||||||
|
comments: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
},
|
||||||
plugins: production ? [
|
plugins: production ? [
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.BannerPlugin({ banner }),
|
||||||
beautify: false,
|
new BundleAnalyzerPlugin({
|
||||||
mangle: {
|
analyzerMode: process.env.ANALYZE_BUILD ? 'server' : 'disabled'
|
||||||
screw_ie8: true,
|
})
|
||||||
keep_fnames: true
|
|
||||||
},
|
|
||||||
compress: {
|
|
||||||
screw_ie8: true
|
|
||||||
},
|
|
||||||
comments: false
|
|
||||||
}),
|
|
||||||
new webpack.BannerPlugin({banner})
|
|
||||||
] : [
|
] : [
|
||||||
new webpack.BannerPlugin({banner})
|
new webpack.BannerPlugin({ banner })
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user