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.

Can I build my app into single js file?

See original GitHub issue

Tried this one, but it didn’t help:

module.exports = {
   webpack: {
      configure: {
         optimization: {
            runtimeChunk: false,
            splitChunks: {
               cacheGroups: {
                  default: false,
               },
            },
         },
      },
   },

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

5reactions
dilakvcommented, Apr 27, 2020

This worked for me.

Generate one file with css and one with js.

if someone gets a better solution i’ll be grateful.


module.exports = {
  webpack: {
    configure: {
      output: {
        filename: 'main.js',
      },
      // externals: {
      //   react: {
      //     root: 'React',
      //     commonjs2: 'react',
      //     commonjs: 'react',
      //     amd: 'react',
      //     umd: 'react',
      //   },
      //   'react-dom': {
      //     root: 'ReactDOM',
      //     commonjs2: 'react-dom',
      //     commonjs: 'react-dom',
      //     amd: 'react-dom',
      //     umd: 'react-dom',
      //   },
      // },
      optimization: {
        runtimeChunk: false,
        splitChunks: {
          chunks: 'all',
          cacheGroups: {
            default: false,
            vendors: false,
            // vendor chunk
          },
        },
      },
    },
  },
  plugins: [
    {
      plugin: require('craco-plugin-scoped-css'),
    },
  ],
}

0reactions
vjsinghcommented, Feb 5, 2021

@gupta-ji6 Is this working in CRA 4? It’s not working for me (commented on that thread as well, but realized it may be a craco issue and not a CRA issue).

Read more comments on GitHub >

github_iconTop Results From Across the Web

combine react build output into single js file - Stack Overflow
Brief. In short: It's possible, but not very practical. Why? Your application will no longer be performant as your single bundle file grows....
Read more >
How to Bundle Create React App in a Single File - Labnol.org
Learn how to bundle all the JavaScript and CSS files generated by the React App build and combine them into a single file....
Read more >
Simplest way to compile all TypeScript into one single Js file ...
It'll convert all TypeScript files that are inside "src" folder and output them in the "dist" folder. Step 1: Create a Simplest project....
Read more >
Can I build my app into single js file? · Issue #155 · dilanx/craco
This worked for me. Generate one file with css and one with js. if someone gets a better solution i'll be grateful. module.exports ......
Read more >
Is there a way to build single js file without external libs? - Reddit
Hi. I'm starting to get around with TypeScript. Trying to build application using WebStorm built in compiler and tsconfig. json I'm almost ...
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