Skip to content

Instantly share code, notes, and snippets.

@Talent30
Last active January 2, 2021 12:37
Show Gist options
  • Save Talent30/234e5863824c48d0f1b58db944984ffb to your computer and use it in GitHub Desktop.
Save Talent30/234e5863824c48d0f1b58db944984ffb to your computer and use it in GitHub Desktop.
Webpack config
const path = require('path');
const webpack = require('webpack');
// const ESLintPlugin = require('eslint-webpack-plugin');
module.exports = {
resolve: {
extensions: ['.jsx', '.js', '.json'],
},
entry: {
index: './src/index.jsx',
// framework: ['react', 'react-dom', 'styled-components'],
},
output: {
path: path.resolve(__dirname, '../dist'),
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: [
'thread-loader',
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
],
},
],
},
plugins: [
new webpack.ProgressPlugin(),
new webpack.AutomaticPrefetchPlugin(),
/* new ESLintPlugin({
files: 'src/*',
threads: true,
}), */
],
};
const { merge } = require('webpack-merge');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const common = require('./webpack.common.config.js');
module.exports = merge(common, {
mode: 'development',
devtool: 'eval-source-map',
cache: {
type: 'memory',
},
output: {
filename: 'js/[name].js',
},
module: {
rules: [
{
test: /\.(sass|css|scss)$/,
use: [
'style-loader',
'css-loader',
],
},
],
},
devServer: {
host: '0.0.0.0',
compress: true,
port: 9001,
},
plugins: [
new HtmlWebpackPlugin({
template: 'public/index.html',
inject: true,
}),
new webpack.HotModuleReplacementPlugin(),
],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment