Skip to content

Instantly share code, notes, and snippets.

@mc0
Created September 12, 2019 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mc0/e19f69b2b26f6b612423c17722250503 to your computer and use it in GitHub Desktop.
Save mc0/e19f69b2b26f6b612423c17722250503 to your computer and use it in GitHub Desktop.
basic ts-loader test
process.stdout.write("test\n");
{
"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"
}
}
{
"compilerOptions": {
"composite": true,
"incremental": true,
"tsBuildInfoFile": "./.tsbuildinfo",
"outDir": "./build"
}
}
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