Skip to content

Commit

Permalink
look, just do what I want please
Browse files Browse the repository at this point in the history
  • Loading branch information
emccorson committed Nov 30, 2023
1 parent dac6e00 commit d959290
Showing 1 changed file with 146 additions and 146 deletions.
292 changes: 146 additions & 146 deletions apps/namada-interface/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,149 +10,149 @@ const { NODE_ENV } = process.env;

console.log(process.env);

const createStyledComponentsTransformer =
require("typescript-plugin-styled-components").default;

const copyPatterns = [
{
from: "./public/*.png",
to: "./assets/[name].png",
},
{
from: "./public/manifest.json",
to: "./manifest.json",
},
{
from: "./public/_redirects",
to: "./_redirects",
},
];

const plugins = [
new CopyPlugin({
patterns: copyPatterns,
}),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
new HtmlWebpackPlugin({
template: resolve("./public/index.html"),
}),
// Provide environment variables to interface:
new webpack.DefinePlugin({
process: {
env: JSON.stringify(process.env),
},
}),
];

module.exports = {
mode: NODE_ENV,
target: "web",
devtool: "eval-source-map",
entry: {
interface: "./src",
},
output: {
publicPath: "/",
path: resolve(__dirname, `./build/`),
filename: "[name].bundle.js",
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/,
options: {
configFile: resolve(__dirname, "tsconfig.webpack.json"),
getCustomTransformers: (program) => ({
before: [
createStyledComponentsTransformer(program, {
setComponentId: true,
setDisplayName: true,
minify: true,
}),
],
}),
},
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.png$/i,
use: [
{
loader: "file-loader",
},
],
},
{
test: /\.wasm$/,
type: "asset/inline",
exclude: /node_modules/,
},
{
test: /\.svg$/,
use: [
{
loader: require.resolve("@svgr/webpack"),
options: {
prettier: false,
svgo: false,
svgoConfig: {
plugins: [{ removeViewBox: false }],
},
titleProp: true,
ref: true,
},
},
{
loader: require.resolve("file-loader"),
options: {
name: "assets/[name].[hash].[ext]",
},
},
],
issuer: {
and: [/\.(ts|tsx|md)$/],
},
},
],
},
resolve: {
alias: {
// Use styled-components from namada-interface, not packages/components
"styled-components": resolve(
__dirname,
"node_modules",
"styled-components"
),
},
extensions: [".tsx", ".ts", ".js"],
modules: [resolve(__dirname, "src/"), "node_modules"],
fallback: {
buffer: require.resolve("buffer/"),
crypto: require.resolve("crypto-browserify"),
},
},
performance: {
hints: "warning",
maxAssetSize: 200000,
maxEntrypointSize: 400000,
assetFilter: function (assetFilename) {
assetFilename.endsWith(".wasm");
},
},
plugins,
devServer: {
static: {
directory: join(__dirname, "public"),
},
compress: false,
port: 3000,
historyApiFallback: true,
},
};
//const createStyledComponentsTransformer =
// require("typescript-plugin-styled-components").default;
//
//const copyPatterns = [
// {
// from: "./public/*.png",
// to: "./assets/[name].png",
// },
// {
// from: "./public/manifest.json",
// to: "./manifest.json",
// },
// {
// from: "./public/_redirects",
// to: "./_redirects",
// },
//];
//
//const plugins = [
// new CopyPlugin({
// patterns: copyPatterns,
// }),
// new webpack.ProvidePlugin({
// Buffer: ["buffer", "Buffer"],
// }),
// new HtmlWebpackPlugin({
// template: resolve("./public/index.html"),
// }),
// // Provide environment variables to interface:
// new webpack.DefinePlugin({
// process: {
// env: JSON.stringify(process.env),
// },
// }),
//];
//
//module.exports = {
// mode: NODE_ENV,
// target: "web",
// devtool: "eval-source-map",
// entry: {
// interface: "./src",
// },
// output: {
// publicPath: "/",
// path: resolve(__dirname, `./build/`),
// filename: "[name].bundle.js",
// },
// module: {
// rules: [
// {
// test: /\.tsx?$/,
// loader: "ts-loader",
// exclude: /node_modules/,
// options: {
// configFile: resolve(__dirname, "tsconfig.webpack.json"),
// getCustomTransformers: (program) => ({
// before: [
// createStyledComponentsTransformer(program, {
// setComponentId: true,
// setDisplayName: true,
// minify: true,
// }),
// ],
// }),
// },
// },
// {
// test: /\.css$/i,
// use: ["style-loader", "css-loader"],
// },
// {
// test: /\.png$/i,
// use: [
// {
// loader: "file-loader",
// },
// ],
// },
// {
// test: /\.wasm$/,
// type: "asset/inline",
// exclude: /node_modules/,
// },
// {
// test: /\.svg$/,
// use: [
// {
// loader: require.resolve("@svgr/webpack"),
// options: {
// prettier: false,
// svgo: false,
// svgoConfig: {
// plugins: [{ removeViewBox: false }],
// },
// titleProp: true,
// ref: true,
// },
// },
// {
// loader: require.resolve("file-loader"),
// options: {
// name: "assets/[name].[hash].[ext]",
// },
// },
// ],
// issuer: {
// and: [/\.(ts|tsx|md)$/],
// },
// },
// ],
// },
// resolve: {
// alias: {
// // Use styled-components from namada-interface, not packages/components
// "styled-components": resolve(
// __dirname,
// "node_modules",
// "styled-components"
// ),
// },
// extensions: [".tsx", ".ts", ".js"],
// modules: [resolve(__dirname, "src/"), "node_modules"],
// fallback: {
// buffer: require.resolve("buffer/"),
// crypto: require.resolve("crypto-browserify"),
// },
// },
// performance: {
// hints: "warning",
// maxAssetSize: 200000,
// maxEntrypointSize: 400000,
// assetFilter: function (assetFilename) {
// assetFilename.endsWith(".wasm");
// },
// },
// plugins,
// devServer: {
// static: {
// directory: join(__dirname, "public"),
// },
// compress: false,
// port: 3000,
// historyApiFallback: true,
// },
//};

0 comments on commit d959290

Please sign in to comment.