Skip to content

Instantly share code, notes, and snippets.

@KonTrax
Created December 14, 2017 01:47
Show Gist options
  • Save KonTrax/c178c4607a691a94739e8d9b0e7d590d to your computer and use it in GitHub Desktop.
Save KonTrax/c178c4607a691a94739e8d9b0e7d590d to your computer and use it in GitHub Desktop.
const n_path = require('path')
//==============================================================================
const CONFIG = {
root: {
src: n_path.resolve('./src'),
dist: n_path.resolve('./dist'),
},
index: 'index.ts',
}
//==============================================================================
module.exports = {//============================================================
entry: n_path.join(CONFIG.root.src, CONFIG.index),
output: {
filename: 'bundle.js',
path: CONFIG.root.dist,
},
// Enable sourcemaps for debugging webpack's output.
devtool: 'source-map',
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [
'.ts',
'.tsx',
'.js',
'.json',
],
},
module: {
rules: [
{// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
test: /\.tsx?$/,
exclude: /(node_modules)/,
loader: 'awesome-typescript-loader',
},
{// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader'
},
],
},
}//=============================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment