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

Not working with laravel-mix with webpack config #122

Open
jingp-ofload opened this issue Nov 4, 2023 · 0 comments
Open

Not working with laravel-mix with webpack config #122

jingp-ofload opened this issue Nov 4, 2023 · 0 comments

Comments

@jingp-ofload
Copy link

jingp-ofload commented Nov 4, 2023

My webpack config is like this:

module: {
        rules: [
            {
                test: /\.(ts|tsx)$/,
                exclude: /node_modules/,
                use: {
                    loader: "swc-loader",
                    options: {
                        parseMap: true,
                        jsc: {
                            target: "es2016",
                            loose: true,
                            parser: {
                                syntax: "typescript",
                                tsx: true,
                                dynamicImport: true
                            },
                            transform: {
                                react: {
                                    runtime: "automatic",
                                }
                            }
                        }
                    }
                },
            },
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                use: [{
                    loader: 'babel-loader',
                    // options: { babelrc: true }
                    options: {
                        presets: [
                            [
                                "@babel/preset-env",
                                {
                                  "targets": {
                                    "chrome": 100
                                  }
                                }
                            ],
                            [
                                "@babel/preset-react",
                                {
                                    "runtime": "automatic"
                                }
                            ]
                        ],
                        plugins: [
                            require("babel-plugin-jsx-control-statements"),
                            require("@babel/plugin-proposal-class-properties"),
                            require("@babel/plugin-proposal-object-rest-spread"),
                            require("@babel/plugin-proposal-optional-chaining"),
                            require("@babel/plugin-syntax-dynamic-import"),
                            require("@babel/plugin-proposal-private-methods")
                        ],
                    }
                }]
            }
        ],
    },
    resolve: {
        extensions: ['.js', '.jsx', '.ts', '.tsx'],
        alias: {
            '@components': path.resolve('resources/js/Components'),
            '@composites': path.resolve('resources/js/composites'),
            '@public': path.resolve('public'),
            '@utils': path.resolve('resources/js/utils'),
        },
    },

But after I deploy, the browser says If is not defined
Screenshot 2023-11-04 at 10 31 23 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant