DocSpace-client/experimental/ASC.Web.LoginMobile/webpack.config.js
2021-02-28 21:59:50 +03:00

105 lines
2.3 KiB
JavaScript

const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const deps = require("./package.json").dependencies;
module.exports = {
entry: "./src/index",
mode: "development",
devServer: {
contentBase: [path.join(__dirname, "public"), path.join(__dirname, "dist")],
port: 5021,
historyApiFallback: true,
hot: false,
hotOnly: false,
},
output: {
publicPath: "auto",
chunkFilename: "[id].[contenthash].js",
},
resolve: {
extensions: [".jsx", ".js", ".json"],
fallback: {
crypto: false,
},
alias: {
"ASC.Web.Components": path.resolve(
__dirname,
"../../packages/asc-web-components/src/"
),
"ASC.Web.Common": path.resolve(
__dirname,
"../../packages/asc-web-common/src"
),
LoginMobileApi: path.resolve(__dirname, "./src/api"),
},
},
module: {
rules: [
{
test: /\.m?js/,
type: "javascript/auto",
resolve: {
fullySpecified: false,
},
},
{
test: /\.react.svg$/,
use: [
{
loader: "@svgr/webpack",
options: {
svgoConfig: {
plugins: [{ removeViewBox: false }],
},
},
},
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
options: {
presets: ["@babel/preset-react", "@babel/preset-env"],
plugins: [
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-export-default-from",
],
},
},
"source-map-loader",
],
},
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
"style-loader",
// Translates CSS into CommonJS
"css-loader",
// Compiles Sass to CSS
"sass-loader",
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: "./public/index.html",
}),
],
};