add webpack config

This commit is contained in:
Labhansh Agrawal
2020-05-01 14:26:03 +05:30
parent 4702a0af9d
commit 7bde7039bb
3 changed files with 50 additions and 4 deletions
+12
View File
@@ -6,6 +6,12 @@
!*.js !*.js
!*.json !*.json
# Whitelist - lib/
!lib/**/*.d.ts
!lib/**/*.js
!lib/**/*.js.map
# Whitelist - out/ # Whitelist - out/
!out/**/*.d.ts !out/**/*.d.ts
@@ -34,3 +40,9 @@ docs/
coverage/ coverage/
.nyc_output/ .nyc_output/
fonts/ fonts/
**/*.api.js
**/*.api.ts
tsconfig.json
.yarnrc
webpack.config.js
+6 -4
View File
@@ -13,16 +13,18 @@
"engines": { "engines": {
"node": ">8.0.0" "node": ">8.0.0"
}, },
"main": "out/LigaturesAddon.js", "main": "lib/xterm-addon-ligatures.js",
"types": "typings/xterm-addon-ligatures.d.ts", "types": "typings/xterm-addon-ligatures.d.ts",
"scripts": { "scripts": {
"prepare": "node bin/download-fonts.js", "prepare": "node bin/download-fonts.js",
"build": "tsc -p src", "build": "../../node_modules/.bin/tsc -p src",
"watch": "tsc -w -p src", "watch": "../../node_modules/.bin/tsc -w -p src",
"prepackage": "npm run build",
"package": "../../node_modules/.bin/webpack",
"pretest": "npm run build", "pretest": "npm run build",
"test": "nyc mocha out/**/*.test.js", "test": "nyc mocha out/**/*.test.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls", "coveralls": "nyc report --reporter=text-lcov | coveralls",
"prepublish": "npm run build" "prepublish": "npm run package"
}, },
"keywords": [ "keywords": [
"font", "font",
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
const path = require('path');
const addonName = 'LigaturesAddon';
const mainFile = 'xterm-addon-ligatures.js';
module.exports = {
entry: `./out/${addonName}.js`,
devtool: 'source-map',
target: 'electron-renderer',
module: {
rules: [
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre",
exclude: /node_modules/
}
]
},
output: {
filename: mainFile,
path: path.resolve('./lib'),
library: addonName,
libraryTarget: 'umd'
},
mode: 'production'
};