Verified Commit e6d31d81 authored by Connor Shea's avatar Connor Shea 🏄

Update the way index.html is handled by webpack.

parent 91a1c74a
Pipeline #26347656 passed with stage
in 1 minute and 9 seconds
......@@ -12,7 +12,6 @@ pages:
- yarn run webpack
- mkdir public
- mv dist/ public/
- mv index.html public/index.html
artifacts:
paths:
- public/*
......
......@@ -5,8 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>MDN BCD File Creator</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="dist/bundle.css" />
<script src="dist/bundle.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="<%= htmlWebpackPlugin.files.css %>" />
<script src="<%= htmlWebpackPlugin.files.js %>"></script>
</head>
<body>
<pre id="output-json"></pre>
......
{
"dependencies": {
"css-loader": "^1.0.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.4.1",
"node-sass": "^4.9.2",
"sass-loader": "^7.0.3",
......
const path = require('path');
const devMode = process.env.NODE_ENV !== 'production';
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: devMode ? 'development' : 'production',
entry: [ path.resolve(__dirname, 'src/main.js'), path.resolve(__dirname, 'src/main.scss') ],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
filename: devMode ? 'bundle.js' : '[hash].bundle.js'
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "bundle.css"
})
filename: devMode ? 'bundle.css' : '[hash].bundle.css'
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: __dirname + '/index.html',
inject: false
})
],
devtool: "source-map",
devtool: devMode ? "inline-source-map" : "source-map",
module: {
rules: [
{
......
This diff is collapsed.
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