fix: enhance compile config

This commit is contained in:
春希 2020-03-31 21:27:13 +08:00
parent 49ac9a3f08
commit 2899149b9c
3 changed files with 6 additions and 8 deletions

View File

@ -27,7 +27,8 @@
"tsconfig-paths": "^3.9.0", "tsconfig-paths": "^3.9.0",
"tsconfig-paths-webpack-plugin": "^3.2.0", "tsconfig-paths-webpack-plugin": "^3.2.0",
"webpack": "^4.42.1", "webpack": "^4.42.1",
"webpack-cli": "^3.3.11" "webpack-cli": "^3.3.11",
"webpack-node-externals": "^1.7.2"
}, },
"ava": { "ava": {
"compileEnhancements": false, "compileEnhancements": false,

View File

@ -1,15 +1,10 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"module": "es2015",
"noImplicitAny": true,
"sourceMap": true,
"moduleResolution": "node",
"isolatedModules": true,
"target": "es5", "target": "es5",
"strictNullChecks": true, "strictNullChecks": true,
"inlineSources": false, "inlineSources": false,
"lib": ["es2015"], "lib": ["es6"],
"downlevelIteration": true, "downlevelIteration": true,
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": ["./src/*"]

View File

@ -1,4 +1,5 @@
const path = require('path'); const path = require('path');
const nodeExternals = require('webpack-node-externals');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
module.exports = { module.exports = {
@ -6,7 +7,7 @@ module.exports = {
target: 'node', target: 'node',
entry: { entry: {
index: './src/index.ts', index: './src/index.ts',
// demo: './src/demo/main.ts', demo: './src/demo/main.ts',
}, },
module: { module: {
rules: [ rules: [
@ -26,4 +27,5 @@ module.exports = {
filename: '[name].js', filename: '[name].js',
path: path.resolve(__dirname, 'lib'), path: path.resolve(__dirname, 'lib'),
}, },
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
}; };