question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in production enviroment

See original GitHub issue

I use Sortable-tree in my project, works fine in development enviroment, but after running npm run build I get the following error in the browser console:

main.js:910 Uncaught TypeError: n is not a function at Object.<anonymous> (main.js:910) at t (main.js:28) at Object.<anonymous> (main.js:1062) at t (main.js:28) at Object.<anonymous> (main.js:1029) at t (main.js:28) at main.js:82 at main.js:82 at main.js:2441 at Object../node_modules/react-sortable-tree/dist/main.js (main.js:2441)

issue

this only happen in production enviroment.

mm

How can i fix that?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mjyoungcommented, Aug 25, 2018

Any update to this? I’m experiencing the same issue:

Webpack config:

webpack.config.prod.js

const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const extractCSS = new ExtractTextPlugin('[name].fonts.css');
const extractSCSS = new ExtractTextPlugin('[name].styles.css');

const BUILD_DIR = path.resolve(__dirname, 'build');
const SRC_DIR = path.resolve(__dirname, 'src');

console.warn('BUILD_DIR', BUILD_DIR);
console.warn('SRC_DIR', SRC_DIR);

module.exports = (env = {}) => {
  console.warn('===================');
  console.warn('Running environment: ', env.NODE_ENV);
  console.warn('===================');

  return {
    entry: {
      index: [SRC_DIR + '/index.js'],
    },
    node: {
      child_process: 'empty',
    },
    output: {
      path: BUILD_DIR,
      filename: '[name].bundle.js',
      chunkFilename: '[name].bundle.js?[chunkhash]',
      publicPath: '/',
    },
    devtool: 'source-map',
    module: {
      rules: [
        {
          test: /\.(js|jsx)$/,
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader',
            options: {
              cacheDirectory: true,
              presets: ['react', 'env', 'stage-0'],
            },
          },
        },
        {
          test: /\.html$/,
          loader: 'html-loader',
        },
        {
          test: /\.(scss)$/,
          use: ['css-hot-loader'].concat(
            extractSCSS.extract({
              fallback: 'style-loader',
              use: [
                {
                  loader: 'css-loader',
                  options: {
                    alias: { '../img': '../public/img' },
                  },
                },
                {
                  loader: 'sass-loader',
                },
              ],
            })
          ),
        },
        {
          test: /\.css$/,
          use: extractCSS.extract({
            fallback: 'style-loader',
            use: 'css-loader',
          }),
        },
        {
          test: /\.(png|jpg|jpeg|gif|ico)$/,
          use: [
            {
              loader: 'file-loader',
              options: {
                name: './img/[name].[hash].[ext]',
              },
            },
          ],
        },
        {
          test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
          loader: 'file-loader',
          options: {
            name: './fonts/[name].[hash].[ext]',
          },
        },
      ],
    },
    plugins: [
      new webpack.EnvironmentPlugin({
        NODE_ENV: env.NODE_ENV,
      }),
      new webpack.optimize.UglifyJsPlugin({ sourceMap: true }),
      extractCSS,
      extractSCSS,
      new HtmlWebpackPlugin({
        hash: true,
        inject: true,
        template: './public/index.html',
      }),
      new CopyWebpackPlugin([{ from: './public/img', to: 'img' }], {
        copyUnmodified: false,
      }),
    ],
  };
};
0reactions
rohmanhmcommented, Dec 27, 2018

I fixed my issue by disabling code split.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Tips To Quickly Tackle Errors in Your Production Code
We will take a look at some simple solutions that can be used to find errors in production as well as ways to...
Read more >
DebuggerEvents error in Production Environment - OutSystems
Hello. I got the following error in service center, in Production environment: The file '/<ModuleName>/_debuggerEvents.ashx' does not exist.
Read more >
How should you handle errors in a production environment?
There's no single good approach to handling errors, since how an error should be handled completely depends on the exact situation.
Read more >
Error coming in Prod - Studio - UiPath Community Forum
Hi All, From yesterday i got error in one of my process in Production. here i am attaching the screenshot of that, can...
Read more >
12 Feelings Every Developer Has After Introducing an Error to ...
Waiting for your code to compile? Trying to find the root cause of an issue you've encountered? Here are a few Gifs that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found