Created
September 12, 2019 02:58
-
-
Save mc0/e19f69b2b26f6b612423c17722250503 to your computer and use it in GitHub Desktop.
basic ts-loader test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.stdout.write("test\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test", | |
"version": "0.0.0", | |
"description": "Test", | |
"main": "build/index.js", | |
"scripts": { | |
"build": "node --max-old-space-size=2048 ./node_modules/.bin/webpack --mode=production --env.NODE_ENV=production", | |
"tsc": "tsc -p ." | |
}, | |
"author": "", | |
"license": "MIT", | |
"devDependencies": { | |
"ts-loader": "6.1.0", | |
"typescript": "3.6.3", | |
"webpack": "4.39.3", | |
"webpack-cli": "3.3.8" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"composite": true, | |
"incremental": true, | |
"tsBuildInfoFile": "./.tsbuildinfo", | |
"outDir": "./build" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = env => { | |
const plugins = [ | |
]; | |
const tsLoader = { | |
loader: 'ts-loader', | |
options: { | |
projectReferences: true | |
}, | |
}; | |
const config = { | |
entry: { index: './index.tsx' }, | |
module: { | |
rules: [ | |
{ | |
test: /\.(tsx?)$/, | |
use: [tsLoader], | |
} | |
], | |
}, | |
output: { | |
filename: '[name].js', | |
path: path.resolve(__dirname, 'build'), | |
}, | |
plugins, | |
resolve: { | |
extensions: ['.ts', '.tsx'], | |
}, | |
}; | |
return config; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment