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

Webpack Mix extremely slow with alternative Project Structure #3370

Open
julianlaibach opened this issue Aug 13, 2023 · 0 comments
Open

Webpack Mix extremely slow with alternative Project Structure #3370

julianlaibach opened this issue Aug 13, 2023 · 0 comments

Comments

@julianlaibach
Copy link

julianlaibach commented Aug 13, 2023

  • Laravel Mix Version: 6.0.6
  • Node Version 19.9.0:
  • NPM Version 9.6.3
  • OS: php:8.2.4-apache Docker Image

Description:

I have a Project where we have two seperate Frontends (FrontendA, FrontendB) so my Folder Structure is like this:

  • resources
    • ProjectA
      • package.lock
      • package.json
      • node_modules
      • js/css etc.
    • ProjectB
      • package.lock
      • package.json
      • node_modules
      • js/css etc.

given the Project Structure above, if i am running npm run watch/dev/prod all processes are extremely slow and bumping up the CPU usage to 100%. If i move the node_modules folder outside the ProjectA or ProjectB Folder and run npm run watch/dev/prod again the Process is super quick. Does Webpack also search through the node_modules Folder? In the Documentation it says that the node_modules are excluded automatically...

Here is my webpack.mix.js:

mix.setPublicPath('../../public')

// JS File
mix.js('./js/app.js', 'project/js')
    .vue()
    .version()

mix.js('./js/nova.js', 'project/js')
    .version()

// CSS File
mix.postCss('./css/app.css', 'project/css', [
    require("tailwindcss"),
]).version()

mix.postCss('./css/saferpay.css', 'project/css').version()
mix.postCss('./css/froala.css', 'project/css').version()
mix.postCss('./css/fonts.css', 'project/css').version()

mix.sass('./css/panorama.scss', 'project/css').version()
mix.sass('./css/fontawesome.scss', 'project/css').version()

module.exports = [
    {
        test: /^\.\/node_modules$/,
        exclude: 'node_modules',
    }, 
    {
        test: /\.scss$/,
        loaders: ['style', 'css?sourceMap', 'sass'],
    }, 
    {
        test: /\.(png|jpg|jpeg|gif|svg|eot)(\?.*$|$)/,
        loader: 'file'
    }
]
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