Skip to content

Commit 65a74eb

Browse files
committed
Use webpack instead of Browserify
1 parent 880ee0b commit 65a74eb

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules/
2-
public/js/app/*.js
2+
public/js/app/
33
temp/

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
"devDependencies": {
1212
"@types/react": "^0.14.39",
1313
"@types/react-dom": "^0.14.17",
14-
"browserify": "^13.0.0",
1514
"mkdirp": "^0.5.1",
16-
"typescript": "^2.0.3"
15+
"source-map-loader": "^0.1.5",
16+
"ts-loader": "^0.9.0",
17+
"typescript": "^2.0.3",
18+
"webpack": "^1.13.2"
1719
},
1820
"scripts": {
19-
"build": "mkdirp public/js/app && tsc && browserify ./temp/app.js -o public/js/app/bundle.js",
21+
"build": "webpack",
2022
"start": "http-server"
2123
},
2224
"author": "Benny van Reeven",

webpack.config.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
entry: "./app/app.tsx",
3+
output: {
4+
filename: "./public/js/app/bundle.js",
5+
},
6+
7+
// Enable sourcemaps for debugging webpack's output.
8+
devtool: "source-map",
9+
10+
resolve: {
11+
// Add '.ts' and '.tsx' as resolvable extensions.
12+
extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
13+
},
14+
15+
module: {
16+
loaders: [
17+
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
18+
{ test: /\.tsx?$/, loader: "ts-loader" }
19+
],
20+
21+
preLoaders: [
22+
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
23+
{ test: /\.js$/, loader: "source-map-loader" }
24+
]
25+
},
26+
};

0 commit comments

Comments
 (0)