Skip to content

Instantly share code, notes, and snippets.

@jeremejazz
Created March 28, 2019 10:31
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 jeremejazz/ba069d01389f2805e896e6c6811f331a to your computer and use it in GitHub Desktop.
Save jeremejazz/ba069d01389f2805e896e6c6811f331a to your computer and use it in GitHub Desktop.
Typescript and Webpack configuration for multi-page site
{
"compilerOptions": {
"outDir": "./public/js/dist",
"allowJs": true,
"target": "es5",
"module": "es6"
},
"include": [
"./public/js/src/**/*"
]
}
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: {
index: './public/js/src/index.ts',
orders: './public/js/src/orders.ts'
},
output: {
filename: "./[name].bundle.js" ,
path: path.resolve(__dirname, 'public', 'dist')
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: '/node_modules/'
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment