A simple deposit and profit bytom dapp demo
Revision | 23c4557dc58b53d668b1f4cb8eb87c6d673dcdd6 (tree) |
---|---|
Time | 2019-04-01 18:41:55 |
Author | Zhiting Lin <zlin035@uott...> |
Commiter | Zhiting Lin |
init webpack.config.js
@@ -0,0 +1,78 @@ | ||
1 | +const path = require("path"); | |
2 | +const HtmlWebpackPlugin = require("html-webpack-plugin"); | |
3 | +const CopyWebpackPlugin = require('copy-webpack-plugin'); | |
4 | +const webpack = require("webpack"); | |
5 | + | |
6 | +module.exports = { | |
7 | + entry: ["babel-polyfill", "./src/index.js"], | |
8 | + output: { | |
9 | + path: path.join(__dirname, "/dist"), | |
10 | + filename: "index-bundle.js", | |
11 | + }, | |
12 | + module: { | |
13 | + rules: [ | |
14 | + { | |
15 | + test: /\.(js|jsx)$/, | |
16 | + exclude: /node_modules/, | |
17 | + use: ["babel-loader"] | |
18 | + }, | |
19 | + { | |
20 | + test: /\.(woff(2)?|ttf|eot|svg|otf)(\?v=\d+\.\d+\.\d+)?$/, | |
21 | + loaders: [{ | |
22 | + loader: 'file-loader', | |
23 | + options: { | |
24 | + name: '[name].[ext]', | |
25 | + outputPath: 'fonts/', | |
26 | + }, | |
27 | + }], | |
28 | + }, | |
29 | + { | |
30 | + test:/\.(s*)css$/, | |
31 | + use:['style-loader','css-loader', 'sass-loader'] | |
32 | + } | |
33 | + ] | |
34 | + }, | |
35 | + devServer: { | |
36 | + historyApiFallback: true, | |
37 | + port: 8080, | |
38 | + // Send API requests on localhost to API server get around CORS. | |
39 | + proxy: { | |
40 | + '/dapptestnet': { | |
41 | + target:'http://app.bycoin.io:3200/dapp', | |
42 | + secure: false, | |
43 | + pathRewrite: { | |
44 | + '^/dapptestnet': '' | |
45 | + } | |
46 | + }, | |
47 | + '/dapp': { | |
48 | + target:'http://app.bycoin.io:3100/dapp', | |
49 | + secure: false, | |
50 | + pathRewrite: { | |
51 | + '^/dapp': '' | |
52 | + } | |
53 | + }, | |
54 | + } | |
55 | + }, | |
56 | + resolve: { | |
57 | + extensions: ['.scss', '.css', '.js', '.jsx', '.json'], | |
58 | + }, | |
59 | + plugins: [ | |
60 | + new CopyWebpackPlugin([ | |
61 | + { | |
62 | + from: './contracts', | |
63 | + to: 'contracts/' | |
64 | + } | |
65 | + ]), | |
66 | + new HtmlWebpackPlugin({ | |
67 | + template: "./src/index.html" | |
68 | + }), | |
69 | + new webpack.ProvidePlugin({ | |
70 | + jQuery: 'jquery', | |
71 | + $: 'jquery', | |
72 | + jquery: 'jquery' | |
73 | + }) | |
74 | + ], | |
75 | + externals: { | |
76 | + config: "config", | |
77 | + } | |
78 | +}; | |
\ No newline at end of file |