Commit 6915dd1c authored by Kai Brandes's avatar Kai Brandes

use webpack html-loader

parent 8ff42fd5
This diff is collapsed.
......@@ -14,6 +14,8 @@
],
"author": "Kai Brandes <kai.brandes@codecentric.de>",
"dependencies": {
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"materialize-css": "^1.0.0-rc.2",
"react": "^16.5.2",
"react-dom": "^16.5.2",
......
......@@ -4,8 +4,7 @@
<title>Hello wasm-pack!</title>
</head>
<body>
<script src="./dist/bundle.js"></script>
<section id="solutions"></section>
<section id="solutions2"></section>
<h1>Advent of Code (WASM)</h1>
<div id="solutions"></div>
</body>
</html>
const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");
const webpack = require("webpack");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: "./src/index.js",
mode: "development",
plugins: [
new CopyWebpackPlugin(['./public/index.html'])
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
loader: "babel-loader",
options: { presets: ["@babel/env"] }
options: {presets: ["@babel/env"]}
},
{
test: /\.css$/,
......@@ -22,17 +18,21 @@ module.exports = {
}
]
},
resolve: { extensions: ["*", ".js", ".jsx", ".wasm"] },
resolve: {extensions: ["*", ".js", ".jsx", ".wasm"]},
output: {
path: path.resolve(__dirname, "dist/"),
publicPath: "/dist/",
filename: "bundle.js"
},
devServer: {
contentBase: path.join(__dirname, "public/"),
contentBase: path.join(__dirname, "dist/"),
port: 3000,
publicPath: "http://localhost:3000/dist/",
publicPath: "http://localhost:3000/",
hotOnly: true
},
plugins: [new webpack.HotModuleReplacementPlugin()]
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: 'src/index.html',
target: 'index.html'
})]
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment