How to use @dojo/webpack-contrib - 10 common examples

To help you get started, we’ve selected a few @dojo/webpack-contrib 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 dojo / cli-build-app / src / dist.config.ts View on Github external
window.navigator.serviceWorker.register('service-worker.js');
			});
		}
	`,
				type: 'append'
			}),
		new webpack.BannerPlugin({
			banner,
			test: /^.*\.js$/i
		}),
		new CleanWebpackPlugin(['dist', 'info'], { root: output!.path, verbose: false })
	].filter((item) => item);

	if (args['build-time-render']) {
		config.plugins.push(
			new BuildTimeRender({
				...args['build-time-render'],
				entries: Object.keys(config.entry!),
				sync: args.singleBundle,
				basePath,
				baseUrl: base,
				scope: libraryName
			})
		);
	}

	config.plugins = config.plugins.map((plugin) => {
		if (plugin instanceof MiniCssExtractPlugin) {
			return new MiniCssExtractPlugin({
				filename: args.omitHash ? '[name].bundle.css' : '[name].[contenthash].bundle.css'
			});
		}
github dojo / cli-build-app / src / dev.config.ts View on Github external
return {
							loader: loaderName,
							options
						};
					}
					return loader;
				});
			}
			return rule;
		});
	}

	if (args['build-time-render']) {
		config.plugins.push(
			new BuildTimeRender({
				...args['build-time-render'],
				sync: singleBundle,
				entries: Object.keys(config.entry!),
				basePath,
				baseUrl: base,
				scope: libraryName
			})
		);
	}

	config.output = {
		...output,
		path: outputPath
	};

	return config;
github dojo / cli-build-app / src / dist.config.ts View on Github external
openAnalyzer: false,
			generateStatsFile: true,
			reportFilename: '../info/report.html',
			statsFilename: '../info/stats.json'
		}),
		new HtmlWebpackPlugin({
			base,
			inject: true,
			chunks: [entryName],
			meta: manifest ? { 'mobile-web-app-capable': 'yes' } : {},
			template: 'src/index.html',
			cache: false
		}),
		args.externals &&
			args.externals.dependencies &&
			new ExternalLoaderPlugin({
				dependencies: args.externals.dependencies,
				hash: true,
				outputPath: args.externals.outputPath
			}),
		manifest &&
			new WebpackPwaManifest({
				...manifest,
				ios: true,
				icons: Array.isArray(manifest.icons)
					? manifest.icons.map((icon) => ({ ...icon, ios: true }))
					: manifest.icons
			}),
		new InsertScriptPlugin([
			{ content: ``, type: 'prepend' },
			{
				content: `
github dojo / cli-build-app / src / dev.config.ts View on Github external
}

	config.plugins = [
		...plugins!,
		assetsDirExists && new CopyWebpackPlugin([{ from: assetsDir, to: path.join(outputPath, 'assets') }]),
		new HtmlWebpackPlugin({
			base,
			inject: true,
			chunks: [entryName],
			meta: manifest ? { 'mobile-web-app-capable': 'yes' } : {},
			template: 'src/index.html',
			cache: false
		}),
		args.externals &&
			args.externals.dependencies &&
			new ExternalLoaderPlugin({
				dependencies: args.externals.dependencies,
				hash: true,
				outputPath: args.externals.outputPath
			}),
		manifest &&
			new WebpackPwaManifest({
				...manifest,
				ios: true,
				icons: Array.isArray(manifest.icons)
					? manifest.icons.map((icon) => ({ ...icon, ios: true }))
					: manifest.icons
			}),
		new InsertScriptPlugin([
			{ content: ``, type: 'prepend' },
			{
				content: `
github dojo / cli-build-app / src / dev.config.ts View on Github external
icons: Array.isArray(manifest.icons)
					? manifest.icons.map((icon) => ({ ...icon, ios: true }))
					: manifest.icons
			}),
		new InsertScriptPlugin([
			{ content: ``, type: 'prepend' },
			{
				content: ``,
				type: 'append'
			}
		]),
		serviceWorkerOptions && new ServiceWorkerPlugin(serviceWorkerOptions),
		serviceWorkerOptions &&
			new InsertScriptPlugin({
				content: ``,
				type: 'append'
			}),
		new CleanWebpackPlugin(['dev', 'info'], { root: output!.path, verbose: false })
	].filter((item) => item);

	if (module) {
		module.rules = module.rules.map((rule) => {
github dojo / cli-build-app / src / dist.config.ts View on Github external
icons: Array.isArray(manifest.icons)
					? manifest.icons.map((icon) => ({ ...icon, ios: true }))
					: manifest.icons
			}),
		new InsertScriptPlugin([
			{ content: ``, type: 'prepend' },
			{
				content: ``,
				type: 'append'
			}
		]),
		serviceWorkerOptions && new ServiceWorkerPlugin(serviceWorkerOptions),
		serviceWorkerOptions &&
			new InsertScriptPlugin({
				content: ``,
				type: 'append'
			}),
		new webpack.BannerPlugin({
			banner,
			test: /^.*\.js$/i
		}),
		new CleanWebpackPlugin(['dist', 'info'], { root: output!.path, verbose: false })
github dojo / cli-build-app / src / base.config.ts View on Github external
__DOJO_SCOPE: `'${libraryName}'`
			}),
			!isExperimentalSpeed &&
				new OptimizeCssAssetsPlugin({
					cssProcessor: cssnano,
					cssProcessorOptions: {
						map: {
							inline: false
						}
					},
					cssProcessorPluginOptions: {
						preset: ['default', { calc: false }]
					}
				}),
			!singleBundle &&
				new BootstrapPlugin({
					entryPath: mainEntryPath,
					shimModules: [
						{
							module: '@dojo/framework/shim/IntersectionObserver',
							has: 'intersection-observer'
						},
						{
							module: '@dojo/framework/shim/ResizeObserver',
							has: 'resize-observer'
						},
						{
							module: '@dojo/framework/shim/WebAnimations',
							has: 'web-animations'
						},
						{
							module: '@dojo/framework/shim/fetch',
github dojo / cli-build-app / src / base.config.ts View on Github external
/to have no more than (\d*) type selectors/g,
							'to not contain element selectors due to unsafe isolation'
						)
						.replace(
							/to have no more than (\d*) universal selectors/g,
							'to not contain universal (*) selectors due to unsafe isolation'
						);
				},
				context: srcPath,
				files: ['**/*.m.css']
			}),
			singleBundle &&
				new webpack.optimize.LimitChunkCountPlugin({
					maxChunks: 1
				}),
			new CssModulePlugin(basePath),
			new MiniCssExtractPlugin({
				filename: '[name].css'
			}),
			(args.externals || isTest) &&
				new WrapperPlugin({
					test: singleBundle ? new RegExp(`${mainEntry}.*(\.js$)`) : new RegExp(`${bootstrapEntry}.*(\.js$)`),
					footer: `\ntypeof define === 'function' && define.amd && require(['${libraryName}']);`
				}),
			args.locale &&
				new I18nPlugin({
					defaultLocale: args.locale,
					supportedLocales: args.supportedLocales,
					cldrPaths: args.cldrPaths,
					target: mainEntryPath
				}),
			new webpack.DefinePlugin({
github vogloblinsky / web-components-benchmark / pascal-triangle / dojo / config / build-widget / base.config.js View on Github external
jsonpFunction: getJsonpFunctionName(
                `-${packageName}-${jsonpIdent}`
            ),
            libraryTarget: 'jsonp',
            path: path.resolve('./dist')
        },
        resolve: {
            modules: [basePath, path.join(basePath, 'node_modules')],
            extensions
        },
        devtool: false,
        watchOptions: {
            ignored: /node_modules/
        },
        plugins: removeEmpty([
            new CssModulePlugin_1.default(basePath),
            new webpack.BannerPlugin(banner),
            new IgnorePlugin(/request\/providers\/node/),
            new ExtractTextPlugin({
                filename: getPath =>
                    getPath(`[name]-${packageJson.version}.css`)
            }),
            new webpack.NamedChunksPlugin(),
            new webpack.NamedModulesPlugin()
        ]),
        module: {
            rules: removeEmpty([
                tsLint && {
                    test: /\.ts$/,
                    enforce: 'pre',
                    loader: 'tslint-loader',
                    options: {
github dojo / cli-build-app / src / base.config.ts View on Github external
}),
			singleBundle &&
				new webpack.optimize.LimitChunkCountPlugin({
					maxChunks: 1
				}),
			new CssModulePlugin(basePath),
			new MiniCssExtractPlugin({
				filename: '[name].css'
			}),
			(args.externals || isTest) &&
				new WrapperPlugin({
					test: singleBundle ? new RegExp(`${mainEntry}.*(\.js$)`) : new RegExp(`${bootstrapEntry}.*(\.js$)`),
					footer: `\ntypeof define === 'function' && define.amd && require(['${libraryName}']);`
				}),
			args.locale &&
				new I18nPlugin({
					defaultLocale: args.locale,
					supportedLocales: args.supportedLocales,
					cldrPaths: args.cldrPaths,
					target: mainEntryPath
				}),
			new webpack.DefinePlugin({
				__MAIN_ENTRY: JSON.stringify(mainEntryPath),
				__DOJO_SCOPE: `'${libraryName}'`
			}),
			!isExperimentalSpeed &&
				new OptimizeCssAssetsPlugin({
					cssProcessor: cssnano,
					cssProcessorOptions: {
						map: {
							inline: false
						}