How to use the @rails/webpacker.environment.splitChunks function in @rails/webpacker

To help you get started, we’ve selected a few @rails/webpacker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kaishuu0123 / rebacklogs / config / webpack / environment.js View on Github external
const { environment } = require('@rails/webpacker')
const { VueLoaderPlugin } = require('vue-loader')
const webpack = require('webpack')
const vue = require('./loaders/vue')

// enable SplitChunks
environment.splitChunks()

// FIXME:
// environment.splitChunks((config) => {
//   return Object.assign({}, config, {
//     optimization: {
//       splitChunks: {
//         cacheGroups: {
//           vendor: {
//             test:/node_modules/,
//             name: 'vendor',
//             chunks: 'initial',
//             enforce: true
//           },
//           vendorCommons: {
//             test: /app\/javascript\/commons/,
//             name: 'vendor-commons',
github gambala / rubyshow / config / webpack / environment.js View on Github external
const WebpackAssetsManifest = require('webpack-assets-manifest');
const { environment } = require('@rails/webpacker');
const erb = require('./loaders/erb');

environment.loaders.prepend('erb', erb);
environment.splitChunks();

module.exports = environment;
github aergonaut / cody / config / webpack / environment.js View on Github external
const { environment } = require("@rails/webpacker");
const path = require("path");

function resolvePath(relPath) {
  return path.resolve(__dirname, "..", "..", relPath);
}

environment.splitChunks();
environment.loaders.delete("nodeModules");
environment.config.merge({
  resolve: {
    alias: {
      __generated__: resolvePath("app/javascripts/__generated__"),
    },
  },
});
module.exports = environment;