use webpack

This commit is contained in:
chemzqm 2019-06-20 07:36:12 +08:00
parent 4cc3ac524b
commit 143ebcf542
6 changed files with 2790 additions and 34 deletions

View file

@ -2,3 +2,4 @@ src
tsconfig.json tsconfig.json
tslint.json tslint.json
*.map *.map
yarn.lock

View file

@ -14,7 +14,7 @@
], ],
"scripts": { "scripts": {
"clean": "rimraf lib", "clean": "rimraf lib",
"build": "tsc -p tsconfig.json", "build": "webpack",
"prepare": "npx npm-run-all clean build" "prepare": "npx npm-run-all clean build"
}, },
"activationEvents": [ "activationEvents": [
@ -472,15 +472,17 @@
"@types/fast-diff": "^1.2.0", "@types/fast-diff": "^1.2.0",
"@types/node": "^12.0.7", "@types/node": "^12.0.7",
"coc.nvim": "^0.0.69", "coc.nvim": "^0.0.69",
"fast-diff": "^1.2.0",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"tslint": "^5.17.0" "semver": "^6.1.1",
"ts-loader": "^6.0.3",
"tslint": "^5.17.0",
"vscode-languageserver-protocol": "^3.15.0-next.5",
"webpack": "^4.34.0",
"webpack-cli": "^3.3.4",
"which": "^1.3.1"
}, },
"dependencies": { "dependencies": {
"fast-diff": "^1.2.0", "typescript": "3.5.1"
"semver": "^6.1.1",
"tslib": "^1.9.3",
"typescript": "3.5.1",
"vscode-languageserver-protocol": "^3.15.0-next.5",
"which": "^1.3.1"
} }
} }

View file

@ -135,7 +135,7 @@ export function fork(
// Create the process // Create the process
logger.info('Forking TSServer', `PATH: ${newEnv['PATH']} `) logger.info('Forking TSServer', `PATH: ${newEnv['PATH']} `)
const bootstrapperPath = path.resolve(__dirname, '../../../bin/tsserverForkStart') const bootstrapperPath = path.resolve(__dirname, '../bin/tsserverForkStart')
childProcess = cp.fork(bootstrapperPath, [modulePath].concat(args), { childProcess = cp.fork(bootstrapperPath, [modulePath].concat(args), {
silent: true, silent: true,
env: newEnv, env: newEnv,

View file

@ -1,18 +1,15 @@
{ {
"extends": "./node_modules/@chemzqm/tsconfig/tsconfig.json", "extends": "./node_modules/@chemzqm/tsconfig/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"declaration": false,
"outDir": "lib", "outDir": "lib",
"target": "es2015", "target": "es2015",
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"noImplicitThis": true, "noImplicitThis": true,
"importHelpers": true,
"lib": ["es2018"], "lib": ["es2018"],
"plugins": [] "plugins": []
}, },
"include": [ "include": ["src"],
"src" "exclude": []
],
"exclude": [
]
} }

41
webpack.config.js Normal file
View file

@ -0,0 +1,41 @@
const path = require('path')
module.exports = {
entry: './src/index.ts',
target: 'node',
mode: 'none',
resolve: {
mainFields: ['module', 'main'],
extensions: ['.js', '.ts']
},
externals: {
'coc.nvim': 'commonjs coc.nvim',
'typescript': 'commonjs typescript'
},
module: {
rules: [{
test: /\.ts$/,
exclude: /node_modules/,
use: [{
loader: 'ts-loader',
options: {
compilerOptions: {
"sourceMap": true,
}
}
}]
}]
},
output: {
path: path.join(__dirname, 'lib'),
filename: 'index.js',
libraryTarget: "commonjs",
},
plugins: [
],
node: {
__dirname: false,
__filename: false
}
}

2753
yarn.lock

File diff suppressed because it is too large Load diff