JSFiddle - React, Tailwind, and code Playground
JavaScript
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
devtool: 'eval-sourcemap',
entry: "./client/src/index.js",
output: {
path: path.join(__dirname, "/client/dist"),
filename: "index-bundle.js"
},
devServer: {
overlay: true, // чтобы вылезали ошибки на экране браузера а не в консоли
historyApiFallback: true
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ["babel-loader"]
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [
'file-loader'
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: "./client/src/index.html"
}),
new ExtractTextPlugin('style.css')
]
};