Add simple webpack builder into the project

pull/227/head
Denis Demchenko 6 years ago
parent 0bcb5713cd
commit 5149acc2c5

@ -1,5 +1,8 @@
{
"presets": ["env"],
"plugins": [
"add-module-exports"
],
"env": {
"test": {
"plugins": [ "istanbul" ],

1
.gitignore vendored

@ -5,3 +5,4 @@ node_modules/
/lib/
.nyc_output
coverage
dist

@ -3,3 +3,4 @@ src/useragents.js
Makefile
.nyc_output
coverage
dist

16765
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -29,6 +29,9 @@
"devDependencies": {
"ava": "^0.25.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-add-module-exports": "^0.3.1",
"babel-plugin-istanbul": "^4.1.6",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
@ -42,6 +45,8 @@
"nyc": "^12.0.2",
"sinon": "^2.4.1",
"testem": "^1.18.5",
"webpack": "^4.15.1",
"webpack-cli": "^3.0.8",
"yamljs": "^0.3.0"
},
"ava": {
@ -63,8 +68,5 @@
"coverage": "nyc report --reporter=text-lcov | coveralls",
"docs": "jsdoc -c jsdoc.json"
},
"license": "MIT",
"dependencies": {
"semver": "^5.5.0"
}
"license": "MIT"
}

@ -0,0 +1,35 @@
const path = require('path');
module.exports = {
mode: 'production', // "production" | "development" | "none"
// Chosen mode tells webpack to use its built-in optimizations accordingly.
entry: './src/bowser.js', // string | object | array
// defaults to ./src
// Here the application starts executing
// and webpack starts bundling
output: {
// options related to how webpack emits results
path: path.resolve(__dirname, 'dist'), // string
// the target directory for all output files
// must be an absolute path (use the Node.js path module)
filename: 'bowser.compiled.js', // string
// the filename template for entry chunks
library: 'bowser',
libraryTarget: 'umd', // universal module definition
// the type of the exported library
globalObject: 'this',
},
module: {
// configuration regarding modules
rules: [
// rules for modules (configure loaders, parser options, etc.)
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
},
},
],
},
};
Loading…
Cancel
Save