Hello
We’re struggling with Webpack for a Bitbucket app. I’m not yet 100% sure where to start.
The high level issue:
- When the app is installed on its own or with many other apps, it seems fine.
- However, the app breaks other apps, like Crucible Review Hook for Bitbucket
From my debugging, it looks like the apps seem to clash on the webpack ‘runtime’ things.
I’ve noticed:
- Bitbucket ships a webpack runtime
- Our Javascript bundled with webpack and the Atlassian Client-Side Webpack pluging also ships / includes a webpack runtime.
- Looks like these two runtimes the stop over each other and module definitions get messed up.
Ok: We had similar issues with another app. There we disabled the ‘runtimeChunking’. I tried that again, but this has some unexpected side effect in the generated wr-webpack.xml file.
Before:
{
optimization: {
runtimeChunk: 'single',
}
}
Then the generated wr-webpack.xml does have the required dependencies, the aui-select
in this case.
<web-resource key="split_codeowners">
<transformation extension="js">
<transformer key="jsI18n"/>
</transformation>
<dependency>com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path</dependency>
<dependency>com.atlassian.auiplugin:aui-flag</dependency>
<dependency>com.atlassian.bitbucket.server.bitbucket-web-api:navbuilder</dependency>
<dependency>com.atlassian.bitbucket.state.bitbucket-web-api:state</dependency>
<dependency>com.atlassian.bitbucket.server.bitbucket-web-api:server</dependency>
<dependency>com.atlassian.bitbucket.events.bitbucket-web-api:events</dependency>
<dependency>com.atlassian.auiplugin:aui-select</dependency>
<resource type="download" name="codeowners.js" location="js/codeowners.js"/>
</web-resource>
However, when I disable the chunking with runtimeChunk: false
, then the aui-select
dependency is simply omitted:
<web-resource key="entrypoint-codeowners">
<transformation extension="js">
<transformer key="jsI18n"/>
</transformation>
<context>bitbucket.page.compare</context>
<context>bitbucket.page.pullRequest.view</context>
<context>bitbucket.page.pullRequest.detail</context>
<dependency>com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path</dependency>
<dependency>com.atlassian.auiplugin:aui-flag</dependency>
<dependency>com.atlassian.bitbucket.server.bitbucket-web-api:navbuilder</dependency>
<dependency>com.atlassian.bitbucket.server.bitbucket-web-api:server</dependency>
<resource type="download" name="codeowners.js" location="js/codeowners.js"/>
</web-resource>
So, I am stuck:
- Is the app supposed to ship with the webpack runtime or now? How do I avoid conflicts with other apps with the webpack module resolution?
- Why does the
runtimeChunk
influence the imports in the generatedwr-webpack.xml
? Is there a way to fix that?