Skip to content

Instantly share code, notes, and snippets.

@mrtcmn
Created January 1, 2021 13:22
Show Gist options
  • Save mrtcmn/6fea1fc0823ffbfe7e6f9c066ebc3ca9 to your computer and use it in GitHub Desktop.
Save mrtcmn/6fea1fc0823ffbfe7e6f9c066ebc3ca9 to your computer and use it in GitHub Desktop.
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const outputPath = path.join(__dirname, "dist")
const port = process.env.PORT || 3000;
module.exports = {
context: __dirname,
entry: './src/App.jsx',
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
},
resolve: {
modules: ['node_modules', './src'],
extensions: ['.js', '.jsx'],
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
use: 'css-loader!sass-loader'
}),
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: 'css-loader'
}),
},
{
test: /\.less$/,
loaders: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 1 } },
'less-loader',
],
},
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
},
plugins: [
new ExtractTextPlugin("bundle.css"),
],
devServer: {
port,
historyApiFallback: true,
publicPath: '/dist/',
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment