How to use the webpack.DllReferencePlugin function in webpack

To help you get started, we’ve selected a few webpack 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 ChartIQ / finsemble-seed / build / webpack / defaultWebpackConfig.js View on Github external
constructor() {
		let plugins =
			[
				new EnvironmentPlugin(['NODE_ENV']),
				new ProgressPlugin({ profile: false })
			]

		try {
			const VENDOR_MANIFEST = require('./vendor-manifest.json');
			plugins.push(new DllReferencePlugin({
				manifest: VENDOR_MANIFEST
			}));
		} catch (e) {
			//This should never happen. Vendor-manifest is built prior to files being built. But it's here just in case.
			console.error(`[WEBPACK ERROR:] You have not generated a vendor-manifest for your webpack configuration. This is an important optimization that reduces build times by 30-40%. Please run "npm run build:vendor-manifest", and then run "npm run dev" once more. You are required to build the vendor manifest when you delete your dist folder, when your node modules update, or when you update the Finsemble Seed project.`);
			process.exit(1);
		}

		if (env === "production") {
			// When building the production environment, minify the code.
			plugins.push(new UglifyJsPlugin());
		} else {
			plugins.push(new hardSource({
				//root dir here is "dist". Back out so we dump this file into the root.
				cacheDirectory: '../.webpack-file-cache/[confighash]',
				// Either an absolute path or relative to webpack's options.context.
github cdmbase / fullstack-pro / tools / webpack.run.js View on Github external
function useWebpackDll() {
  console.log("Using Webpack DLL vendor bundle");
  const jsonPath = path.join('..', settings.frontendBuildDir, 'vendor_dll.json');
  clientConfig.plugins.push(new webpack.DllReferencePlugin({
    context: process.cwd(),
    manifest: require(jsonPath) // eslint-disable-line import/no-dynamic-require
  }));
  serverConfig.plugins.push(new webpack.DllReferencePlugin({
    context: process.cwd(),
    manifest: require(jsonPath) // eslint-disable-line import/no-dynamic-require
  }));
}
github CarbonDesigns / carbon-ui / scripts / make-ui-config.js View on Github external
//     names: ["common", "manifest"]
            // }),

            new (require('chunk-manifest-webpack-plugin'))({
                filename: "manifest.json",
                manifestVariable: "webpackManifest"
            }),

            //breaks incremental updates in watch mode...
            new webpack.optimize.OccurrenceOrderPlugin(),
            new ExtractTextPlugin("[name]-[contenthash].css")
        );
    }

    plugins.push(
        new webpack.DllReferencePlugin({
            manifest: require(fullPath("../target/vendors-manifest.json")),
            context: fullPath("../src")
        }));

    return plugins;
}
github rekit / rekit / tools / server.js View on Github external
function startDevServer() {
  const app = express();
  const devConfig = getConfig('dev');

  devConfig.plugins.push(new webpack.DllReferencePlugin({
    context: srcPath,
    manifest: require(manifestPath),
  }));

  const compiler = webpack(devConfig);
  app.use(devMiddleware(compiler, {
    publicPath: devConfig.output.publicPath,
    historyApiFallback: true,
  }));

  app.use(hotMiddleware(compiler));

  // First, find files from src folder
  app.use(express.static(path.join(__dirname, '../src')));

  // Also support files from root folder, mainly for the dev-vendor bundle
github supnate / command-pad / tools / server.js View on Github external
function startDevServer() {
  devConfig.entry = {
    main: [
      `webpack-dev-server/client?http://localhost:${PORT}`,
      'webpack/hot/only-dev-server',
      './styles/index.less',
      './index',
    ],
  };
  devConfig.plugins.push(new webpack.DllReferencePlugin({
    context: srcPath,
    manifest: require(manifestPath),
  }));
  new WebpackDevServer(webpack(devConfig), {
    publicPath: devConfig.output.publicPath,
    contentBase: devConfig.devServer.contentBase,
    hot: true,
    noInfo: false,
    quiet: false,
    https: false,
    historyApiFallback: true,
  }).listen(PORT, (err) => {
    if (err) {
      console.log(err);
    }
    console.log(`Listening at localhost:${PORT}`);
github qdouble / angular-webpack-starter / webpack.config.ts View on Github external
new CheckerPlugin(),
    new DefinePlugin(CONSTANTS),
    new NamedModulesPlugin(),
    new FilterWarningsPlugin({
      exclude: /System\.import/,
    }),
    ...MY_CLIENT_PLUGINS,
  ];

  if (DEV_SERVER) {
    config.plugins.push(
      new DllReferencePlugin({
        context: '.',
        manifest: require(`./dll/polyfill-manifest.json`),
      }),
      new DllReferencePlugin({
        context: '.',
        manifest: require(`./dll/vendor-manifest.json`),
      }),
      new HtmlWebpackPlugin({
        template: 'src/index.html',
        inject: false,
      })
    );
  }

  if (DLL) {
    config.plugins.push(
      new DllPlugin({
        name: '[name]',
        path: root('dll/[name]-manifest.json'),
      })
github m860 / react-ssr / webpack / webpack.spa.config.js View on Github external
{from: path.join(__dirname, "../build/" + dllManifest.name + ".js")}
    ])
);
config.plugins.push(
    new HtmlWebpackPlugin({
        filename: "index.html",
        template: path.join(__dirname, "../src/index.html"),
        inject: false,
        chunksSortMode: "none",
        dlls: [
            dllManifest.name + ".js"
        ]
    })
);
config.plugins.push(
    new webpack.DllReferencePlugin({
        manifest: path.join(__dirname, "../build/manifest.json"),
    })
);

if (process.env.NODE_ENV === webpackBase.ENV_PRODUCTION) {
    config.entry = [
        path.join(__dirname, '../src/spa.js')
    ];
    config.plugins.push(
        new MiniCssExtractPlugin({
            filename: '[name].[hash].css',
            chunkFilename: '[id].[hash].css'
        })
    );
}
else {
github Vmlweb / MEAN-Angular / tasks / client / build.js View on Github external
const dllLibs = require('../../builds/client/libs.json')

				//Remove semantic if in theme mode
				if (process.env.THEME){
					delete dllLibs.content['./node_modules/semantic-ui-less/semantic.less']
				}

				//Add dll connection plugins
				setup.plugins.push(
					new webpack.HotModuleReplacementPlugin(),
					new webpack.NamedModulesPlugin(),
					new webpack.DllReferencePlugin({
						context: '.',
						manifest: require('../../builds/client/vendor.json')
					}),
					new webpack.DllReferencePlugin({
						context: '.',
						manifest: dllLibs
					})
				)
			}
		}

		//Add css collectors
		if (!(process.env.NODE_ENV === 'development' && !process.env.THEME && !libs)){
			setup.plugins.push(new WebpackExtractText({
				filename: 'style.css',
				allChunks: true
			}))
		}

		//Add source map plugins for development
github zzlw / webpack-dev-super / conf / webpack.dev.config.js View on Github external
}

/**
 * loader config
 * @type {RegExp}
 */
config.module.loaders.push({
  test: /\.css$/,
  loader: 'style!css'
}, {
  test: /\.scss$/,
  loader: 'style!css!sass'
});

config.plugins.push(
  new webpack.DllReferencePlugin({
      context: __dirname,
      manifest: require(path.resolve(publicPath,'react-manifest.json')),
      name:'react_library'
  }),
  new webpack.optimize.OccurenceOrderPlugin(),
  new webpack.HotModuleReplacementPlugin(),
  new webpack.NoErrorsPlugin(),
  new ExtractTextPlugin('[name].css'),
  new BrowserSyncPlugin({
    host: '127.0.0.1',
    port: 9090,
    proxy: 'http://127.0.0.1:9000/',
    logConnections: false,
    notify: false
  }, {
    reload: false