Created
March 28, 2019 10:31
-
-
Save jeremejazz/ba069d01389f2805e896e6c6811f331a to your computer and use it in GitHub Desktop.
Typescript and Webpack configuration for multi-page site
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": { | |
"outDir": "./public/js/dist", | |
"allowJs": true, | |
"target": "es5", | |
"module": "es6" | |
}, | |
"include": [ | |
"./public/js/src/**/*" | |
] | |
} |
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
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