Skip to content

Instantly share code, notes, and snippets.

@lagagain
Created March 9, 2020 14:58
Show Gist options
  • Save lagagain/d37cfec205251779df36a33be77db969 to your computer and use it in GitHub Desktop.
Save lagagain/d37cfec205251779df36a33be77db969 to your computer and use it in GitHub Desktop.
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const config = {
mode: 'development',
entry:{
index: "./src/index.js",
},
output:{
path: path.resolve(__dirname, "dist"),
filename: '[name].js',
},
//publicPath: "./",
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
//plugins: [require('@babel/plugin-transform-object-rest-spread')]
}
}
}, {
test: /\.css$/,
include: [
path.resolve(__dirname, "public")
],
exclude: /(node_modules|bower_components)/,
use: ['style-loader', 'css-loader'],
},{
test: /\.less$/,
loader: 'less-loader',
},
]
},
plugins: [
new HtmlWebpackPlugin({
index: './public/index.html'
})
]
};
module.exports = config;
//npm install --save-dev [email protected] @babel/core @babel/preset-env webpack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment