robosats/frontend/webpack.config.ts
Reckless_Satoshi 1dea4e73b6
Refactor and Init RoboSats PRO (#296)
commit 9c6d55cfc7
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Thu Oct 20 10:35:49 2022 -0700

    Small fixes

commit 23d6c00ccb
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Thu Oct 20 06:12:42 2022 -0700

    Refactor frontend

commit b2c21d4a98
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Wed Oct 19 07:26:00 2022 -0700

    Small fixes (more)

commit 78a8ab799d
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Wed Oct 19 02:11:03 2022 -0700

    Try out to revert depth chart

commit ef73c980a8
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Tue Oct 18 11:43:37 2022 -0700

    Small fixes

commit fa3e60208f
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Tue Oct 18 09:43:03 2022 -0700

    Add old UserGen and BottomBar to new main.tsx

commit 1e257d1924
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Tue Oct 18 04:01:53 2022 -0700

    Add Maker and Book page to new main.tsx

commit 037d46ceef
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Mon Oct 17 08:54:55 2022 -0700

    Add Main component WIP

commit e43b274c33
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Date:   Mon Oct 17 04:32:43 2022 -0700

    App as functional component
2022-10-20 11:06:16 -07:00

91 lines
2.0 KiB
TypeScript

import path from 'path';
import { Configuration } from 'webpack';
import CopyPlugin from 'copy-webpack-plugin';
const config: Configuration = {
entry: './src/index.js',
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
},
},
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js'],
},
};
const configWeb: Configuration = {
...config,
output: {
path: path.resolve(__dirname, 'static/frontend'),
filename: 'basic.js',
},
};
const configMobile: Configuration = {
...config,
module: {
...config.module,
rules: [
...(config?.module?.rules || []),
{
test: path.resolve(__dirname, 'src/i18n/Web.js'),
loader: 'file-replace-loader',
options: {
condition: 'if-replacement-exists',
replacement: path.resolve(__dirname, 'src/i18n/Native.js'),
async: true,
},
},
],
},
plugins: [
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'static/css'),
to: path.resolve(__dirname, '../mobile/html/Web.bundle/css'),
},
],
}),
],
output: {
path: path.resolve(__dirname, '../mobile/html/Web.bundle/js'),
filename: 'main.js',
},
};
const configWebPro: Configuration = {
...config,
module: {
...config.module,
rules: [
...(config?.module?.rules || []),
{
test: path.resolve(__dirname, 'src/basic/Main.tsx'),
loader: 'file-replace-loader',
options: {
condition: 'if-replacement-exists',
replacement: path.resolve(__dirname, 'src/pro/Main.tsx'),
async: true,
},
},
],
},
output: {
path: path.resolve(__dirname, 'static/frontend'),
filename: 'pro.js',
},
};
export default [configWeb, configWebPro, configMobile];