This commit is contained in:
Ray Elliott 2021-01-03 16:58:32 +00:00
parent 7adf443e07
commit 4458e677ee
9 changed files with 3345 additions and 6 deletions

3331
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack serve",
"build": "webpack" "build": "webpack"
}, },
"author": "", "author": "",
@ -24,6 +25,7 @@
"postcss-simple-vars": "^6.0.2", "postcss-simple-vars": "^6.0.2",
"style-loader": "^2.0.0", "style-loader": "^2.0.0",
"webpack": "^5.11.1", "webpack": "^5.11.1",
"webpack-cli": "^4.3.1" "webpack-cli": "^4.3.1",
"webpack-dev-server": "^3.11.1"
} }
} }

View File

Before

Width:  |  Height:  |  Size: 269 KiB

After

Width:  |  Height:  |  Size: 269 KiB

View File

@ -1,7 +1,7 @@
import './style.css'; import '../css/style.css';
import './style.inline.css'; import '../css/style.inline.css';
import MyImage from './my-image.png'; import MyImage from '../img/my-image.png';
function component() { function component() {
const element = document.createElement('div'); const element = document.createElement('div');

View File

@ -4,16 +4,22 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = { module.exports = {
entry: './src/index.js', mode: 'development',
entry: './src/js/index.js',
output: { output: {
filename: '[name].bundle.js', filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
}, },
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
hot: true,
},
plugins: [ plugins: [
new MiniCssExtractPlugin(), new MiniCssExtractPlugin(),
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'src/index.html' template: 'src/html/index.html'
}), }),
], ],
module: { module: {