Registry / testing / babel-plugin-import-remove-resource-query

babel-plugin-import-remove-resource-query

JSON →
library1.0.0jsnpmunverified

Babel plugin that strips resource query parameters (e.g., ?query) from import/require statements during compilation. Version 1.0.0, no further releases. Designed to work around Jest's lack of support for webpack resource queries in imports. Simple, single-purpose plugin with no configuration needed.

npm install babel-plugin-import-remove-resource-query
INSTALL
IMPORT
SIG · BABEL-PLUGIN-IMPOR
B
babel-plugin-import-remove-resource-query
testingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = require('babel-plugin-import-remove-resource-query')
import plugin from 'babel-plugin-import-remove-resource-query'
This plugin is used in babel config, which typically uses CommonJS require. ESM import works but not standard in babel config.
plugins
plugins: ['babel-plugin-import-remove-resource-query']
plugins: [['babel-plugin-import-remove-resource-query', { /* options */ }]]
Plugin has no options, so array form with empty args is valid but unnecessary.
module syntax (no import needed)
Add to .babelrc or babel.config.js as a plugin string.
No import needed; plugin is loaded by Babel automatically.

Shows usage in Babel config and transformation of imports/require removing query strings.

// babel.config.js module.exports = { presets: ['@babel/preset-env'], plugins: ['babel-plugin-import-remove-resource-query'] }; // input.js import 'path/to/file?resourceQuery'; import foo from 'path/to/file?query'; require('path/to/file?resourceQuery'); // output.js import 'path/to/file'; import foo from 'path/to/file'; require('path/to/file');
Debug
Known issues
gotchaPlugin strips ALL query parameters, including legitimate ones like ?inline for CSS.
fix
If needed, use a different approach or customize the plugin (not currently supported).
affects: >=1.0.0
gotchaNo version updates since initial release; may not support newer Babel versions.
fix
Test with your Babel version; consider alternative if incompatibility arises.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-import-remove-resource-query'
Plugin not installed or not in node_modules.
fix
Run 'npm install babel-plugin-import-remove-resource-query --save-dev' or 'yarn add --dev babel-plugin-import-remove-resource-query'.
require() of ES Module not supported
Using ESM import in babel.config.js (e.g., .mjs) while plugin is CJS.
fix
Use require() in babel config or rename file to .js and use module.exports.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
babel-plugin-import-remove-resource-query — npm install babel-plugin-import-remove-resource-query · libregistry