@atlassian/webresource-webpack-plugin

中文文档
7.2.2发布于 2026/10/23Apache-2.0TypeScriptCommonJS近 30 天下载 3764

Auto-generates web-resource definitions from your webpacked code, for usage in an Atlassian product or plugin.

原始使用文档
文档目录41 节
  1. Why?
  2. What does it do?
  3. How to use the plugin
  4. Basic setup
  5. Demonstration P2 plugin usage
  6. Features
  7. Code splitting
  8. Flexible generation of web-resource definitions
  9. Module-mapping to web-resource s
  10. Legacy web-resource inclusion
  11. Legacy runtime resource inclusion
  12. Configuring the plugin
  13. pluginKey (Required)
  14. xmlDescriptors (Required)
  15. addEntrypointNameAsContext (Optional)
  16. addAsyncNameAsContext (Optional)
  17. contextMap (Optional)
  18. conditionMap (Optional)
  19. dataProvidersMap (Optional)
  20. deprecatedEntrypoints (Optional)
  21. transformationMap (Optional)
  22. webresourceKeyMap (Optional)
  23. providedDependencies (Optional)
  24. wrmManifestPath (Optional)
  25. resourceParamMap (Optional)
  26. locationPrefix (Optional)
  27. devAssetsHash (Optional)
  28. watch and watchPrepare (Optional)
  29. useDocumentWriteInWatchMode (Optional)
  30. noWRM (Optional)
  31. singleRuntimeWebResourceKey (Optional)
  32. chunkLoadingGlobal (Optional)
  33. verbose (Optional)
  34. Minimum requirements
  35. Recommended with webpack 5
  36. Upgrade guides
  37. Troubleshooting and known problems
  38. Self troubleshooting tool
  39. Runtime problems
  40. Multiple apps on one page (chunk/module ID conflicts)
  41. Other problems

NOTE: @atlassian/webresource-webpack-plugin replaces the old atlassian-webpack-webresource-plugin package, which is now deprecated.

Atlassian Web-Resource webpack Plugin

node npm webpack

Auto-generates web-resource definitions from your webpacked code, for usage in an Atlassian product or plugin.

Why?

Atlassian's P2 plugin system was shipped in 2008. At the time, the dependency management system in P2 -- the Web Resource Manager, or WRM -- was a godsend for managing the growing complexity of the front-end resources. It offered, amongst other things:

  • The ability to specify bundles of related resources, called a "web-resource".
  • The ability to specify inter-dependencies of web-resources, so that
  • Batching of necessary code in production could be achieved, and
  • Source order could be maintained.

Fast-forward to 2017, and front-end development is drastically different from it was back then. JavaScript module systems and webpack have solved many of the problems the WRM initially set out to.

Unfortunately, Atlassian's plugin system doesn't speak webpack. Happily, though, we can teach webpack to speak Atlassian-Plugin. That's what this plugin does.

What does it do?

When you add this plugin to your webpack configuration, it will generate an XML file with the various WRM configuration necessary to make your code run in an Atlassian product.

You will be able to write your plugin's front-end code using any JavaScript module system. This plugin will figure out how to turn all of it in to the correct <web-resource> declarations, along with the appropriate <dependency> declarations so that your code ends up loading in the right order at a product's runtime.

This plugin supports and generates correct WRM output for the following webpack behaviours:

  • a <web-resource> per webpack entry point
  • correct <web-resource>s for code-splitting / loading asynchronous chunks
  • loading of non-JavaScript resources (via ExtractTextPlugin and friends).

How to use the plugin

Basic setup

Add this plugin to your webpack config. For every entry point webpack generates, an appropriate <web-resource> definition will be generated in an XML file for you, which can then be bundled in to your Atlassian product or plugin, ready to be served to the browser at product runtime.

Given this webpack config:

const WrmPlugin = require('@atlassian/webresource-webpack-plugin');

module.exports = {
  entry: {
    'my-feature': path.join(FRONTEND_SRC_DIR, 'simple.js'),
  },
  plugins: [
    new WrmPlugin({
      pluginKey: 'my.full.plugin.artifact-id',
      contextMap: {
        'my-feature': ['atl.general'],
      },
      xmlDescriptors: path.resolve(OUTPUT_DIR, 'META-INF', 'plugin-descriptors', 'wr-defs.xml'),
    }),
  ],
  output: {
    filename: 'bundled.[name].js',
    path: path.resolve(OUTPUT_DIR),
  },
};

The output will go to <OUTPUT_DIR>/META-INF/plugin-descriptors/wr-defs.xml, and look something like this:

<bundles>

        <web-resource key="entrypoint-my-feature">
            <transformation extension="js">
                <transformer key="jsI18n"/>
            </transformation>
            <context>atl.general</context>
            <resource name="bundled.my-feature.js" type="download" location="bundled.my-feature.js" />
        </web-resource>

</bundles>

Also, <OUTPUT_DIR>/META-INF/fe-manifest-associations/ will include list of resources created by this webpack build and NPM package name for AMPs resource association feature.

Package name can be specified by passing packageName field to WrmPlugin directly, otherwise it is taken automatically from the closest parent package.json of Webpack context directory.

Association is automatically detected by AMPs in P2 plugins and is expected to be in target/classes/META-INF/fe-manifest-associations of plugin build.

Consuming the output in your P2 plugin

In your P2 plugin project's pom.xml file, add the META-INF/plugin-descriptors directory as a value to an <Atlassian-Scan-Folders> tag in the <instruction> section of the AMPS plugin's build configuration.

<build>
  <plugins>
    <plugin>
      <!-- START of a bunch of stuff that is probably different for your plugin, but is outside
           the scope of this demonstration -->
      <groupId>com.atlassian.maven.plugins</groupId>
      <artifactId>maven-amps-plugin</artifactId>
      <version>6.2.11</version>
      <!-- END differences with your plugin -->
      <configuration>
        <instructions>
          <Atlassian-Scan-Folders>META-INF/plugin-descriptors</Atlassian-Scan-Folders>
        </instructions>
      </configuration>
    </plugin>
  </plugins>
</build>

Demonstration P2 plugin usage

You can see a demonstration P2 plugin using the webpack plugin here: sao4fed-bundle-the-ui

  • Watch this AtlasCamp 2018 talk which uses this plugin amongst others to make your devloop super fast: https://youtu.be/VamdjcJCc0Y
  • Watch this AtlasCamp 2017 talk about how to build and integrate your own front-end devtooling on top of P2, which introduced the alpha version of this plugin: https://youtu.be/2yf-TzKerVQ?t=537

Features

Code splitting

If you write your code using any of webpack's code-splitting techniques, such as calling require.ensure, this plugin will automatically generate <web-resource> definitions for them, and automatically translate them in to the appropriate calls to load them asynchronously at an Atlassian product's runtime.

In other words, there's practically no effort on your part to make your critical path small :)

Flexible generation of web-resource definitions

By default, a generated web-resource will have:

  • A key based on the name of your webpack entry-point, and
  • Will be included in a <context> named after your entry-point.

For example, an entry point named "my-feature" will yield a web-resource like this:

<web-resource key="entrypoint-my-feature">
  <context>my-feature</context>
  <!-- the resources for your entry-point -->
</web-resource>

For new code, this should be enough to get your feature loading in to a place you want it to in your plugin or product -- assuming the appropriate call on the server-side is made to include your web-resource.

Sometimes, in order to ensure your code loads when it's expected to, you will need to override the values generated for you. To do this, when defining the WrmPlugin's config, you can provide either:

  • A webresourceKeyMap to change the web-resource's key or name to whatever you need it to be, or
  • A contextMap to include the web-resource in any number of web-resource contexts you expect it to load in to.

It's most likely that you'll want to specify additional contexts for a web-resource to load in to. When all of your web-resources are automatically generated and loaded via contexts, there is no need to know its key. You would typically provide your own web-resource key when refactoring old code to webpack, in order to keep the dependencies working in any pre-existing code.

Module-mapping to web-resources

If you use a common library or module -- for example, 'jquery' or 'backbone' -- and you know that this module is provided by a P2 plugin in the product's runtime, you can map your usage of the module to the web-resource that provides it.

All you need to do is declare the appropriate webpack external for your module, and add an entry for the external in the providedDependencies configuration of this plugin. When your code is compiled, this plugin will automatically add an appropriate web-resource dependency that will guarantee your code loads after its dependants, and will prevent your bundle from getting too large.

For details, check the providedDependencies section in the configuration section.

Legacy web-resource inclusion

90% of the time, your JavaScript code should be declaring explicit dependencies on other modules. In the remaining 10% of cases, you may need to lean on the WRM at runtime to ensure your code loads in the right order. 9% of the time, the module-mapping feature should be enough for you. In the remaining 1%, you may just need to add a web-resource dependency to force the ordering.

You can add import statements to your code that will add a <dependency> to your generated web-resource.

To include web-resources from exported by this plugin you can use short notation like:

// in AMD syntax
define(function (require) {
  require('wr-dependency!my-webresource');
  console.log('my-webresource will have been loaded synchronously with the page');
});

// in ES6
import 'wr-dependency!my-webresource';

console.log('my-webresource will have been loaded synchronously with the page');

To include resources exported by other plugins, provide full plugin key:

// in AMD syntax
define(function (require) {
  require('wr-dependency!com.atlassian.auiplugin:dialog2');
  console.log('webresource will have been loaded synchronously with the page');
});

// in ES6 syntax
import 'wr-dependency!com.atlassian.auiplugin:dialog2';

console.log('webresource will have been loaded synchronously with the page');

Legacy runtime resource inclusion

95% of the time, your application's non-JavaScript resources -- CSS, images, templates, etc. -- are possible to bundle and include via webpack loaders. Sometimes, though, you will have resources that only work during an Atlassian product's runtime -- think things like Atlassian Soy templates and a product's Less files for look-and-feel styles -- and it isn't possible to make them work during ahead-of-time compilation.

In these cases, you can add import statements to your code that will add a <resource> to your generated web-resource:

// in AMD syntax
define(function (require) {
  require('wr-resource!my-runtime-styles.css!path/to/the/styles.less');
  require('wr-resource!my-compiled-templates.js!path/to/the/templates.soy');

  console.log('these styles and templates will be transformed to CSS and JS at product runtime.');
});

// in ES6 syntax
import 'wr-resource!my-runtime-styles.css!path/to/the/styles.less';
import 'wr-resource!my-compiled-templates.js!path/to/the/templates.soy';

console.log('these styles and templates will be transformed to CSS and JS at product runtime.');

Configuring the plugin

The Atlassian Web-Resource webpack Plugin has a number of configuration options.

pluginKey (Required)

The fully-qualified groupId and artifactId of your P2 plugin. Due to the way the WRM works, this value is necessary to provide in order to support loading of asynchronous chunks, as well as arbitrary (non-JavaScript) resources.

xmlDescriptors (Required)

An absolute filepath to where the generated XML should be output to. This should point to a sub-directory of the Maven project's ${project.build.outputDirectory} (which evaluates to target/classes in a standard Maven project).

The sub-directory part of this configuration value needs to be configured in the project's pom.xml, as demonstrated in the basic usage section above.

addEntrypointNameAsContext (Optional)

Default is false.

When set to true, all generated web-resources will be added to a context with the same name as the entrypoint.

Any character in the entrypoint name that breaks the batch URL is replaced with a -, and any leading - is dropped: the entrypoint feature/nested/app becomes the context feature-nested-app. Use the "contextMap" option to manually set a name.

addAsyncNameAsContext (Optional)

Default is false.

When set to true, all generated web-resources for async chunks that have a name (specified via webpackChunkName on import) will be added to a context of the name "async-chunk-", with the same character replacement as addEntrypointNameAsContext.

contextMap (Optional)

A set of key-value pairs that allows you to specify which webpack entry-points should be present in what web-resource contexts at an Atlassian product runtime.

You can provide either a single web-resource context as a string, or an array of context strings.

These names are used as written, so a name that breaks the batch URL fails the build: a context may not contain /, ?, +, ,, #, %, &, whitespace or anything outside printable ASCII, and may not begin with -. Values that are not a non-empty string are ignored.

conditionMap (Optional)

An object specifying what conditions should be applied to a certain entry-point. Simple example:

conditionMap: {
  "my-first-entry-point": {
    "class": "foo.bar"
  },
}

will yield:

<condition class="foo.bar" />

Complex nested example with params:

conditionMap: {
  "my-first-entry-point": {
    "type": "AND",
    "conditions": [
      {
        "type": "OR",
        "conditions": [
          {
            "class": "foo.bar.baz",
            "invert": true,
            "params": [
              {
                "attributes": {
                  "name": "permission"
                },
                "value": "admin"
              }
            ]
          },
          {
            "class": "foo.bar.baz2",
            "params": [
              {
                "attributes": {
                  "name": "permission"
                },
                "value": "project"
              }
            ]
          }
        ]
      },
      {
        "class": "foo.bar.baz3",
        "params": [
          {
            "attributes": {
              "name": "permission"
            },
            "value": "admin"
          }
        ]
      }
    ]
  }
}

will yield:

<conditions type="AND">
  <conditions type="OR">
    <condition class="foo.bar.baz" invert="true">
      <param name="permission">admin</param>
    </condition>
    <condition class="foo.bar.baz2" >
      <param name="permission">project</param>
    </condition>
  </conditions>
  <condition class="foo.bar.baz3" >
    <param name="permission">admin</param>
  </condition>
</conditions>

dataProvidersMap (Optional)

The dataProvidersMap option allows configuring the association between entrypoint and a list of data providers.

Data providers can be used to provide a data from the server-side to the frontend, and claimed using WRM.data.claim API. To read more about data providers refer to the official documentation.

To associate the entrypoint with list of data providers you can configure the webpack configuration as follow:

module.exports = {
  entrypoints: {
    'my-first-entry-point': './first-entry-point.js',
    'my-second-entry-point': './first-entry-point.js',
  },

  plugins: [
    WrmPlugin({
      pluginKey: 'my.full.plugin.artifact-id',
      dataProvidersMap: {
        'my-first-entry-point': [
          {
            key: 'my-foo-data-provider',
            class: 'com.example.myplugin.FooDataProvider',
          },
        ],

        'my-second-entry-point': [
          {
            key: 'my-bar-data-provider',
            class: 'com.example.myplugin.BarDataProvider',
          },

          {
            key: 'my-bizbaz-data-provider',
            class: 'com.example.myplugin.BizBazDataProvider',
          },
        ],
      },
    }),
  ],
};

will yield:

<atlassian-plugin>
    <web-resource key="<<key-of-my-first-entry-point>>">
        <resource  />
        <resource  />

        <data key="my-foo-data-provider" class="com.example.myplugin.FooDataProvider" />
    </web-resource>

    <web-resource key="<<key-of-my-first-entry-point>>">
        <resource  />
        <resource  />

        <data key="my-bar-data-provider" class="com.example.myplugin.BarDataProvider" />
        <data key="my-bizbaz-data-provider" class="com.example.myplugin.BizBazDataProvider" />
    </web-resource>
</atlassian-plugin>

deprecatedEntrypoints (Optional)

An object specifying which entry-points should be marked as being deprecated.

A true value may be used instead to simply mark an entry-point as being deprecated without providing any additional information.

Otherwise an object may be used to provide additional context as to when and why the entry-point was deprecated. For the alternative key, the value should either be in the format of plugin-key:web-resource, or be a reference to another entry-point in the same plugin.

module.exports = {
  entrypoints: {
    'my-first-entry-point': './first-entry-point.js',
    'my-second-entry-point': './second-entry-point.js',
    'my-third-entry-point': './third-entry-point.js',
  },

  plugins: [
    WrmPlugin({
      pluginKey: 'my.full.plugin.artifact-id',
      deprecatedEntrypoints: {
        'my-first-entry-point': true,
        'my-second-entry-point': {
          sinceVersion: '3.0',
          removeInVersion: '4.0',
          // alternative could also reference another entrypoint i.e. 'my-third-entry-point'
          alternative: 'some.other.plugin:replacement-resource',
          extraInfo: 'We moved all functionality to some.other.plugin',
        },
      },
    }),
  ],
};

will yield:

<atlassian-plugin>
    <web-resource key="entrypoint-my-first-entry-point">
        <!-- ... rest of definition ... -->
        <deprecated />
    </web-resource>
    <web-resource key="entrypoint-my-second-entry-point">
        <!-- ... rest of definition ... -->
        <deprecated since="3.0"
                    remove="4.0"
                    alternative="some.other.plugin:replacement-resource"
        >
            We moved all functionality to some.other.plugin
        </deprecated>
    </web-resource>
</atlassian-plugin>

transformationMap (Optional)

An object specifying transformations to be applied to file types. The default transformations are:

  • *.js files => jsI18n
  • *.soy files => soyTransformer, jsI18n

Example configuration for custom transformations:

{
  "transformationMap": {
    "js": ["myOwnJsTransformer"],
    "sass": ["myOwnSassTransformer"]
  }
}

This would set the following transformations to every generated web-resource:

<web-resource key="...">
    <transformation extension="js">
      <transformer key="myOwnJsTransformer"/>
    </transformation>
    <transformation extension="sass">
      <transformer key="myOwnSassTransformer"/>
    </transformation>
</web-resource>

If you wish to extend the default transformations you can use the build-in extendTransformations function provided by the plugin. It will merge the default transformations with your custom config:

const WrmPlugin = require('@atlassian/webresource-webpack-plugin');

new WrmPlugin({
  pluginKey: 'my.full.plugin.artifact-id',
  transformationMap: WrmPlugin.extendTransformations({
    js: ['myOwnJsTransformer'],
    sass: ['myOwnSassTransformer'],
  }),
});

You can also completely disable the transformations by passing false value to the plugin configuration:

{
  "transformationMap": false
}

webresourceKeyMap (Optional)

Allows you to change the name of the web-resource that is generated for a given webpack entry-point.

This is useful when you expect other plugins will need to depend on your auto-generated web-resources directly, such as when you refactor an existing feature (and its web-resource) to be generated via webpack.

This parameter can take either string or object with properties key, name and state which corresponds to key, name and state attributes of web-resource XML element. name and state properties are optional.

Mapping as follows:

{
  "webresourceKeyMap": {
    "firstWebResource": "first-web-resource",
    "secondWebResource": {
      "key": "second-web-resource",
      "name": "Second WebResource",
      "state": "disabled"
    }
  }
}

will result in the following web-resources:

<atlassian-plugin>
<web-resource key="first-web-resource" name="" state="enabled">
  <!-- your resources definitions -->
</web-resource>
<web-resource key="second-web-resource" name="Second WebResource" state="disabled">
  <!-- your resources definitions -->
</web-resource>
</atlassian-plugin>

providedDependencies (Optional)

A map of objects that let you associate what web-resources house particular external JS dependencies.

The format of an external dependency mapping is as follows:

{
  'dependency-name': {
    dependency: 'atlassian.plugin.key:webresource-key',
    import: {
      // externals configuration
    },
  },
}

When your code is compiled through webpack, any occurrence of dependency-name found in a module import statement will be replaced in the webpack output, and an appropriate web-resource <dependency> will be added to the generated web-resource.

The import property is either a string or an object that specifies how the dependency should be imported in the code.

The provided object is a JSON object following the webpack externals format.

If you’re not setting the externalsType or library.type in the config, then the default property being used is var. Another popular option is amd as most of the Atlassian products use AMD for loading modules (but then the externalsType should be set too).

wrmManifestPath (Optional)

A path to a WRM manifest file where the plugin will store a map of objects. Under the providedDependencies property is a map of dependencies, including the generated web-resource keys. This map is the exact same format that is accepted with the providedDependencies option above, so one can use this map as a source for providedDependencies in another build:

{
  "providedDependencies": {
    "dependency-name": {
      "dependency": "atlassian.plugin.key:webresource-key",
      "import": {
        "var": "require('dependency-amd-module-name')",
        "amd": "dependency-amd-module-name"
      }
    }
  }
}

Notes and limitations

  • Both output.library and output.libraryTarget must be set for the WRM manifest file to be created.
  • output.library must not contain [chunk] or [hash], however [name] is allowed
  • output.libraryTarget must be set to amd
  • More properties might be added to the WRM manifest file in future

Example configuration

{
  "output": {
    "library": "[name]",
    "libraryTarget": "amd"
  }
}

resourceParamMap (Optional)

An object specifying additional parameters (<param/>) for resources.

To specify for example content-types the server should respond with for a certain assets file-type (e.g. images/fonts):

{
  "resourceParamMap": {
    "svg": [
      {
        "name": "content-type",
        "value": "image/svg+xml"
      }
    ]
  }
}

Setting specific content-types may be required by certain Atlassian products depending on the file-type to load. Contains content-type for svg as "image/svg+xml" by default

locationPrefix (Optional)

Adds given prefix value to location attribute of resource node. Use this option when your webpack output is placed in a subdirectory of the plugin's ultimate root folder.

devAssetsHash (Optional)

Uses provided value (instead of DEV_PSEUDO_HASH) in the webresource name that contains all of the assets needed in development mode.

watch and watchPrepare (Optional)

Activates "watch-mode". This must be run in conjunction with a webpack-dev-server.

watchPrepare

Creates "proxy"-Resources and references them in the XML-descriptor. These proxy-resources will redirect to a webpack-dev-server that has to be run too. In order for this to work properly, ensure that the webpack-config "options.output.publicPath" points to the webpack-dev-server - including its port. (e.g. http://localhost:9000)

watch (Optional)

Use when running the process with a webpack-dev-server.

useDocumentWriteInWatchMode (Optional)

When set to true, the generated watch mode modules will add the script tags to the document synchronously with document.write while the document is loading, rather than always relying on asynchronously appended script tags (default behaviour).

This is useful when bundles are expected to be available on the page early, e.g. when code in a template relies on javascript to be loaded blockingly.

noWRM (Optional)

Will not add any WRM-specifics to the webpack-runtime or try to redirect async-chunk requests while still handling requests to wr-dependency and wr-resource. This can be useful to develop frontend outside of a running product that provides the WRM functionality.

singleRuntimeWebResourceKey (Optional)

Set a specific web-resource key for the webpack runtime when using the webpack option optimization.runtimeChunk to single (see runtimeChunk documentation). Default is common-runtime.

chunkLoadingGlobal (Optional)

Override the value used for output.chunkLoadingGlobal when the plugin sets it automatically. In Webpack 5 and Rspack, chunkLoadingGlobal is the global variable used for loading chunks. When multiple apps that use this plugin load on the same page, each app must have a distinct chunkLoadingGlobal so chunk/module IDs do not conflict. If you do not set output.chunkLoadingGlobal in your config, the plugin sets it from pluginKey (or from this option if provided). If you already set output.chunkLoadingGlobal in your webpack/rspack config, that value is left unchanged.

verbose (Optional)

Indicate verbosity of log output. Default is false.

Minimum requirements

This plugin has been built to work with the following versions of the external build tools:

This plugin is tested with webpack 5.0+ and rspack 1.5+.

  • To compile CSS, use css-loader >= 5 along with mini-css-extract-plugin >= 2.
  • When using mini-css-extract-plugin runtime option needs to be set to false. This will prevent mini-css-extract-plugin from injecting extracted css to document head, which is done by WRM.

Upgrade guides

Troubleshooting and known problems

Self troubleshooting tool

We provide a tool that helps troubleshoot the configuration of webpack and Atlassian P2 projects.

To check if your project was configured correctly, open a terminal and navigate to the root directory of your project. Next, run the troubleshooting command:

npx @atlassian/wrm-troubleshooting

The tool will ask you a few questions and guide you if it finds issues with your projects' configuration.

You can read more about the troubleshooting tool on the NPM page for the @atlassian/wrm-troubleshooting package.

Runtime problems

e.O is not a function

OR (when minimize: false)

__webpack_require__.O is not a function

If you use bundle web-resources from an external plugin that uses optimization.runtimeChunk: 'single' and optimization.splitChunks.chunks: 'all' you might need to configure your plugin to also use runtime: 'single' so that webpack runtime object that is shared when loading chunks has the same signature.

Multiple apps on one page (chunk/module ID conflicts)

When several apps built with this plugin are loaded on the same page (e.g. different P2 plugins or entry points), each app’s runtime must be isolated. Otherwise they can share the same chunk-loading global and numeric chunk/module IDs can refer to different code in each app.

Solution: Each build must have a distinct output.chunkLoadingGlobal (Webpack 5 / Rspack). The plugin does this for you: if output.chunkLoadingGlobal is not set in your config, it is set from your pluginKey (so each plugin gets a unique runtime). You can override the generated value with the plugin option chunkLoadingGlobal, or set output.chunkLoadingGlobal directly in your webpack/rspack config. No extra per-app config is required when each app uses a different pluginKey.

Other problems

Check that your build and bundle works as you expect without this plugin enabled. You can disable the WRM webpack plugin and bundle the code to verify no errors or warnings are present in the webpack output.

This plugin makes very few changes to what webpack ultimately outputs. If your bundles have content errors, it may be due to version incompatibilities between webpack and the loader plugins in your build configuration.

Known problems with this plugin are listed in the Atlassian Ecosystem issue tracker. Our development team review all open issues and triage on a monthly basis.

版本与发布记录

@atlassian/webresource-webpack-plugin 共发布 32 个版本,首次发布于 2025/05/29;过去 12 个月发布了 19 个版本。

版本发布日期距今
7.2.2latest2026/10/2315 天前
7.2.1-6c1fc7ehash-release2026/10/1919 天前
7.2.1-202301d2026/08/242 个月前
7.2.12026/08/242 个月前
7.2.02026/08/192 个月前
7.1.9-4e673662026/08/192 个月前

其他发布通道:test → 7.0.2-DCA11Y-1773.1,test-4 → 4.10.2-64a2ef2,hash-release → 7.2.1-6c1fc7e。

关于 @atlassian/webresource-webpack-plugin 的常见问题

@atlassian/webresource-webpack-plugin 是什么?

Auto-generates web-resource definitions from your webpacked code, for usage in an Atlassian product or plugin.

如何安装 @atlassian/webresource-webpack-plugin?

在项目目录运行 npm install @atlassian/webresource-webpack-plugin,或使用 pnpm add / yarn add / bun add。

@atlassian/webresource-webpack-plugin 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@atlassian/webresource-webpack-plugin 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@atlassian/webresource-webpack-plugin 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=12。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@atlassian/webresource-webpack-plugin 可以商用吗?

@atlassian/webresource-webpack-plugin 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@atlassian/webresource-webpack-plugin 的下载量有多少?

根据 npm 官方下载统计,@atlassian/webresource-webpack-plugin 在 2026/10/07 – 2026/11/05 这 30 天内被下载 3,764 次,日均约 125 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@atlassian/webresource-webpack-plugin 还在维护吗?

最新版本 7.2.2 发布于 2026/10/23(15 天前);至今共发布 32 个版本,其中过去 12 个月发布了 19 个;首次发布于 2025/05/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。