Skip to content

Commit d75acb5

Browse files
authored
Fix: Stop making assumption that bundle might start with 'define(' (#31)
1 parent f0ad978 commit d75acb5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,15 @@ class MicroservicesWebpackPlugin {
4949
async tapAsync(compilation, callback) {
5050
this.modules = await this.createUrlsToModules(this.modules);
5151

52+
const { libraryTarget } = compilation.runtimeTemplate.outputOptions;
53+
5254
compilation.assets = fromEntries(Object.entries(compilation.assets)
5355
.map(([fileName, asset]) => {
54-
if (!fileName.includes('.js')) {
56+
if (!fileName.includes('.js') || libraryTarget !== 'amd') {
5557
return [fileName, asset];
5658
}
5759

5860
const source = asset.source();
59-
const supportAmdOnly = 'define(';
60-
61-
if (!source.startsWith(supportAmdOnly)) {
62-
return [fileName, asset];
63-
}
6461

6562
const value = [
6663
this.modules

0 commit comments

Comments
 (0)