Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix critical dependency warning in webpack config #783

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions demo/configs/webpack/common.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// All rights reserved.
import { resolve } from "path";
import HtmlWebpackPlugin from "html-webpack-plugin";
import FriendlyErrorsWebpackPlugin from "friendly-errors-webpack-plugin";
import CopyPlugin from "copy-webpack-plugin";
import webpack from "webpack";

// This source code is licensed under the license found in the
// LICENSE file in the root directory of this source tree.

const { resolve } = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const webpack = require("webpack");

module.exports = {
const config = {
entry: "./src/index.tsx",
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
Expand Down Expand Up @@ -82,3 +76,5 @@ module.exports = {
}),
],
};

export default config;
15 changes: 5 additions & 10 deletions demo/configs/webpack/dev.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// All rights reserved.
import { merge } from "webpack-merge";
import commonConfig from "./common";

// This source code is licensed under the license found in the
// LICENSE file in the root directory of this source tree.

// development config
const { merge } = require("webpack-merge");
const commonConfig = require("./common");

module.exports = merge(commonConfig, {
const devConfig = merge(commonConfig, {
mode: "development",
devServer: {
hot: true, // enable HMR on the server
Expand All @@ -23,3 +16,5 @@ module.exports = merge(commonConfig, {
},
devtool: "cheap-module-source-map",
});

export default devConfig;
19 changes: 7 additions & 12 deletions demo/configs/webpack/prod.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// All rights reserved.
import { merge } from "webpack-merge";
import { resolve } from "path";
import Dotenv from "dotenv-webpack";
import commonConfig from "./common";

// This source code is licensed under the license found in the
// LICENSE file in the root directory of this source tree.

// production config
const { merge } = require("webpack-merge");
const { resolve } = require("path");
const Dotenv = require("dotenv-webpack");
const commonConfig = require("./common");

module.exports = merge(commonConfig, {
const prodConfig = merge(commonConfig, {
mode: "production",
output: {
filename: "js/bundle.[contenthash].min.js",
Expand All @@ -20,3 +13,5 @@ module.exports = merge(commonConfig, {
devtool: "source-map",
plugins: [new Dotenv()],
});

export default prodConfig;