52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
// Shared config (dev and prod)
|
|
const {resolve} = require("path");
|
|
const {CheckerPlugin} = require("awesome-typescript-loader");
|
|
const StyleLintPlugin = require("stylelint-webpack-plugin");
|
|
const Dotenv = require("dotenv-webpack");
|
|
|
|
module.exports = function (env, argv) {
|
|
const config = {};
|
|
|
|
config.resolve = {
|
|
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
};
|
|
config.context = resolve(__dirname, "../../src");
|
|
config.module = {
|
|
rules: [],
|
|
};
|
|
config.module.rules.push({
|
|
test: /\.js$/,
|
|
use: ["babel-loader", "source-map-loader"],
|
|
exclude: /node_modules/
|
|
});
|
|
config.module.rules.push({
|
|
test: /\.tsx?$/,
|
|
use: ["babel-loader", "awesome-typescript-loader"]
|
|
});
|
|
|
|
config.module.rules.push({
|
|
test: /\.(jpe?g|png|gif|svg)$/i,
|
|
loaders: [
|
|
"file-loader?hash=sha512&digest=hex&name=assets/img/[hash].[ext]",
|
|
"image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.interlaced=false"
|
|
]
|
|
});
|
|
|
|
config.plugins = [
|
|
new CheckerPlugin(),
|
|
new StyleLintPlugin(),
|
|
new Dotenv({
|
|
path: "./.env.sample"
|
|
}),
|
|
new Dotenv({
|
|
path: "./.env"
|
|
}),
|
|
];
|
|
|
|
config.performance = {
|
|
hints: false
|
|
};
|
|
|
|
return config;
|
|
};
|