Skip to content

Commit

Permalink
Move externals plugin into configs (#234)
Browse files Browse the repository at this point in the history
Move the ExternalLoaderPlugin into the configs since it must be
registered after the HtmlWebpackPlugin in order to function correctly.
  • Loading branch information
mwistrand authored Jan 23, 2019
1 parent 95418c0 commit c6c5d15
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/base.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import CssModulePlugin from '@dojo/webpack-contrib/css-module-plugin/CssModulePlugin';
import ExternalLoaderPlugin from '@dojo/webpack-contrib/external-loader-plugin/ExternalLoaderPlugin';
import BootstrapPlugin from '@dojo/webpack-contrib/bootstrap-plugin/BootstrapPlugin';
import I18nPlugin from '@dojo/webpack-contrib/i18n-plugin/I18nPlugin';
import registryTransformer from '@dojo/webpack-contrib/registry-transformer';
Expand Down Expand Up @@ -364,13 +363,6 @@ export default function webpackConfigFactory(args: any): webpack.Configuration {
cldrPaths: args.cldrPaths,
target: mainEntryPath
}),
args.externals &&
args.externals.dependencies &&
new ExternalLoaderPlugin({
dependencies: args.externals.dependencies,
hash: true,
outputPath: args.externals.outputPath
}),
!singleBundle &&
new webpack.DefinePlugin({
__MAIN_ENTRY: JSON.stringify(mainEntryPath)
Expand Down
8 changes: 8 additions & 0 deletions src/base.test.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as webpack from 'webpack';
import baseConfigFactory, { libraryName } from './base.config';
import ExternalLoaderPlugin from '@dojo/webpack-contrib/external-loader-plugin/ExternalLoaderPlugin';

const WrapperPlugin = require('wrapper-webpack-plugin');

Expand All @@ -12,6 +13,13 @@ function webpackConfig(args: any): webpack.Configuration {

config.plugins = [
...plugins!,
args.externals &&
args.externals.dependencies &&
new ExternalLoaderPlugin({
dependencies: args.externals.dependencies,
hash: true,
outputPath: args.externals.outputPath
}),
new WrapperPlugin({
test: /(all.*(\.js$))/,
footer: `typeof define === 'function' && define.amd && define(['${libraryName}'], function() {});`
Expand Down
8 changes: 8 additions & 0 deletions src/dev.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as fs from 'fs';
import * as path from 'path';
import webpack = require('webpack');
import BuildTimeRender from '@dojo/webpack-contrib/build-time-render/BuildTimeRender';
import ExternalLoaderPlugin from '@dojo/webpack-contrib/external-loader-plugin/ExternalLoaderPlugin';
import ServiceWorkerPlugin, {
ServiceWorkerOptions
} from '@dojo/webpack-contrib/service-worker-plugin/ServiceWorkerPlugin';
Expand Down Expand Up @@ -36,6 +37,13 @@ function webpackConfig(args: any): webpack.Configuration {
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,
Expand Down
8 changes: 8 additions & 0 deletions src/dist.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BuildTimeRender from '@dojo/webpack-contrib/build-time-render/BuildTimeRender';
import ExternalLoaderPlugin from '@dojo/webpack-contrib/external-loader-plugin/ExternalLoaderPlugin';
import BundleAnalyzerPlugin from '@dojo/webpack-contrib/webpack-bundle-analyzer/BundleAnalyzerPlugin';
import ServiceWorkerPlugin, {
ServiceWorkerOptions
Expand Down Expand Up @@ -63,6 +64,13 @@ function webpackConfig(args: any): webpack.Configuration {
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,
Expand Down

0 comments on commit c6c5d15

Please sign in to comment.