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

app.js is too big #17

Open
stone009 opened this issue Dec 27, 2019 · 0 comments
Open

app.js is too big #17

stone009 opened this issue Dec 27, 2019 · 0 comments

Comments

@stone009
Copy link

stone009 commented Dec 27, 2019

When i was run
npm run watch-poll
I noticed that the app.js file is too big(7.4M) even in develop and it make refresh browser so slow.
I don't think it's normal and my webpack.mix.js is:

const mix = require('laravel-mix');

function resolve(dir) {
   return path.join(__dirname, '/resources/vendor/laravue', dir);
}

Mix.listen('configReady', (webpackConfig) => {
   // Add "svg" to image loader test
   let imageLoaderConfig = webpackConfig.module.rules.find(rule => String(rule.test) === String(/(\.(png|jpe?g|gif|webp)$|^((?!font).)*\.svg$)/));
   imageLoaderConfig.exclude = resolve('icons');
})

mix.webpackConfig({
   resolve: {
      extensions: ['.js', '.vue', '.json'],
      alias: {
         'vue$': 'vue/dist/vue.esm.js',
         '@': __dirname + '/resources/vendor/laravue'
      },
   },
   module: {
      rules: [
         {
            test: /\.svg$/,
            loader: 'svg-sprite-loader',
            include: [resolve('icons')],
            options: {
               symbolId: 'icon-[name]'
            }
         },
      ],
   }
});

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/vendor/laravue/app.js', 'public/js')
   // .extract(['vue', 'axios', 'vuex', 'vue-router', 'vue-i18n', 'element-ui'])
   .options({
      processCssUrls: false
   })
   .sass('resources/vendor/laravue/styles/index.scss', 'public/css');
console.log(mix.inProduction())
if (mix.inProduction()) {
   mix.version();
} else {
   // Development settings
   mix.sourceMaps()
      .webpackConfig({
         devtool: 'cheap-eval-source-map' // Fastest for development
      });
}

image

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