UNPKG

typescript-react-webpack-app-creator

Version:

Npm module to create an empty react app with typescript as compiller, webpack as bundler and tslint included.

62 lines (56 loc) 1.83 kB
var path = require('path') var webpack = require('webpack') module.exports = { entry: "./src/index.tsx", output: { filename: "bundle.js", publicPath: "dist", path: __dirname + "/dist" }, // Enable sourcemaps for debugging webpack's output. devtool: "source-map", //configure the dev server to run devServer: { port: 3000, historyApiFallback: true, inline: true, }, resolve: { // Add '.ts' and '.tsx' as resolvable extensions. extensions: [".ts", ".tsx", ".js", ".json"] }, 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. */ rules: [ { test: /\.tsx?$/, loader: "ts-loader", exclude: /node_modules/ }, { test: /\.tsx?$/, enforce: 'pre', loader: 'tslint-loader', options: { configFile: __dirname + '/tslint.json', emitErrors: true, failOnHint: true, } } ] }, // When importing a module whose path matches one of the following, just // assume a corresponding global variable exists and use that instead. // This is important because it allows us to avoid bundling all of our // dependencies, which allows browsers to cache those libraries between builds. externals: { "react": "React", "react-dom": "ReactDOM" }, };