Browse Source

Generate single distribution bundle - fixes #16 (#18)

iss58
Sam Verschueren 7 years ago
committed by Sindre Sorhus
parent
commit
e530ae2d50
  1. 22
      package.json
  2. 1
      tsconfig.json
  3. 31
      webpack.config.js

22
package.json

@ -16,10 +16,12 @@
},
"scripts": {
"prerelease": "npm run build",
"pretest": "npm run build -- --sourceMap",
"pretest": "npm run compile -- --sourceMap",
"test": "npm run lint && nyc ava dist/test",
"lint": "tslint --project .",
"build": "del dist && tsc --declaration"
"build": "npm run clean && webpack",
"compile": "npm run clean && tsc",
"clean": "del dist"
},
"files": [
"dist"
@ -44,18 +46,24 @@
"instanceof",
"object"
],
"dependencies": {
"@sindresorhus/is": "^0.4.0",
"vali-date": "^1.0.0"
},
"devDependencies": {
"@sindresorhus/is": "^0.4.0",
"@types/node": "^8.0.31",
"ava": "*",
"awesome-typescript-loader": "^3.2.3",
"codecov": "^2.3.0",
"del-cli": "^1.1.0",
"license-webpack-plugin": "^1.1.1",
"nyc": "^11.2.1",
"tslint": "^5.8.0",
"tslint-xo": "^0.2.0",
"typescript": "^2.6.1"
"typescript": "^2.6.1",
"vali-date": "^1.0.0",
"webpack": "^3.8.1"
},
"nyc": {
"exclude": [
"dist/test"
]
}
}

1
tsconfig.json

@ -7,6 +7,7 @@
],
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"pretty": true,
"newLine": "lf",
"stripInternal": true,

31
webpack.config.js

@ -0,0 +1,31 @@
'use strict';
const webpack = require('webpack');
const license = require('license-webpack-plugin');
module.exports = {
entry: './source/index.ts',
target: 'node',
devtool: 'source-map',
output: {
filename: 'dist/index.js',
libraryTarget: 'commonjs2'
},
resolve: {
extensions: ['.ts', '.js']
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new license.LicenseWebpackPlugin({
pattern: /.*/,
outputFilename: 'dist/licenses.txt'
})
],
module: {
rules: [
{
test: /\.ts$/,
loader: 'awesome-typescript-loader'
}
]
}
};
Loading…
Cancel
Save