etalon_backend/themes/tps react/webpack.config.js

70 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-12-22 08:07:43 +00:00
const path = require('path');
module.exports = {
entry: path.resolve(__dirname, './src/index.js'),
output: {
2021-12-28 08:11:59 +00:00
path: path.resolve(__dirname, './public'),
2021-12-22 08:07:43 +00:00
filename: 'bundle.js',
publicPath: '/'
},
module: {
rules: [
2022-01-05 08:40:20 +00:00
{
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
},
2021-12-22 08:07:43 +00:00
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
2021-12-28 08:11:59 +00:00
use: [{
loader: 'babel-loader',
2022-01-05 08:40:20 +00:00
// query: {
// presets: ['es2015','react']
// },
2021-12-28 08:11:59 +00:00
options: {
cacheDirectory: true,
plugins: ['@babel/plugin-transform-runtime']
}
}]
2021-12-22 08:07:43 +00:00
},
2021-12-28 08:11:59 +00:00
2021-12-22 08:07:43 +00:00
{
2021-12-28 08:11:59 +00:00
test: /\.(sass|css|scss)$/i,
// s[ac]ss
2021-12-22 08:07:43 +00:00
use: [
2021-12-28 08:11:59 +00:00
// Creates `style` nodes from JS strings
"style-loader",
// Translates CSS into CommonJS
"css-loader",
// Compiles Sass to CSS
"sass-loader",
// "postcss-loader",
],
2021-12-22 08:07:43 +00:00
},
{
test: /\.(jpg|png|svg)$/,
use: {
loader: 'url-loader',
},
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx'],
},
devServer: {
contentBase: path.resolve(__dirname, './public'),
2022-01-05 08:40:20 +00:00
writeToDisk: true,
2021-12-22 08:07:43 +00:00
historyApiFallback: true,
2022-01-05 08:40:20 +00:00
// inline:true,
2021-12-28 08:11:59 +00:00
port: 8001
2021-12-22 08:07:43 +00:00
// contentBase: './',
// hot: true
},
};