OSDN Git Service

[add] #37370 1.7.2のバージョン履歴を整理。
[hengband/web.git] / webpack.config.js
1 //import path from "path";
2 const path = require("path");
3
4 const src = path.resolve(__dirname, "score/src");
5 const dist = path.resolve(__dirname, "score/js");
6
7 module.exports = {
8     entry: {
9         "popularity_ranking": src + "/popurality_ranking.tsx"
10     },
11
12     output: {
13         path: dist,
14         filename: "[name].bundle.js"
15     },
16
17     devtool: "source-map",
18
19     resolve: {
20         // Add '.ts' and '.tsx' as resolvable extensions.
21         extensions: [".ts", ".tsx", ".js", ".jsx", ".json"]
22     },
23
24     module: {
25         rules: [
26             // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
27             {
28                 test: /\.tsx?$/,
29                 loader: "awesome-typescript-loader"
30             },
31
32             // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
33             {
34                 enforce: "pre",
35                 test: /\.js$/,
36                 loader: "source-map-loader"
37             }
38         ]
39
40     },
41
42     // When importing a module whose path matches one of the following, just
43     // assume a corresponding global variable exists and use that instead.
44     // This is important because it allows us to avoid bundling all of our
45     // dependencies, which allows browsers to cache those libraries between builds.
46     externals: {
47         "react": "React",
48         "react-dom": "ReactDOM",
49     },
50 };