Last active
March 21, 2016 05:06
-
-
Save fay-jai/505677310afd8159bfa9 to your computer and use it in GitHub Desktop.
Getting started with Typescript, ReactJS, and Webpack
This file contains hidden or 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 config = { | |
/* | |
* app.ts represents the entry point to your web application. Webpack will | |
* recursively go through every "require" statement in app.ts and | |
* efficiently build out the application's dependency tree. | |
*/ | |
entry: ["./src/app.ts"], | |
/* | |
* The combination of path and filename tells Webpack what name to give to | |
* the final bundled JavaScript file and where to store this file. | |
*/ | |
output: { | |
path: path.resolve(__dirname, "build"), | |
filename: "bundle.js" | |
}, | |
/* | |
* resolve lets Webpack now in advance what file extensions you plan on | |
* "require"ing into the web application, and allows you to drop them | |
* in your code. | |
*/ | |
resolve: { | |
extensions: ["", ".ts", ".tsx", ".js"] | |
}, | |
module: { | |
/* | |
* Each loader needs an associated Regex test that goes through each | |
* of the files you've included (or in this case, all files but the | |
* ones in the excluded directories) and finds all files that pass | |
* the test. Then it will apply the loader to that file. I haven't | |
* installed ts-loader yet, but will do that shortly. | |
*/ | |
loaders: [ | |
{ | |
test: /\.tsx?$/, | |
loader: "ts-loader", | |
exclude: /node_modules/ | |
} | |
] | |
} | |
}; | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment