{"id":19078,"library":"babel-plugin-import-remove-resource-query","title":"babel-plugin-import-remove-resource-query","description":"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.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/hkjorgensen/babel-plugin-import-remove-resource-query","tags":["javascript","babel","webpack","plugin","import","resource","query","resourceQuery","require"],"install":[{"cmd":"npm install babel-plugin-import-remove-resource-query","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-import-remove-resource-query","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-import-remove-resource-query","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This plugin is used in babel config, which typically uses CommonJS require. ESM import works but not standard in babel config.","wrong":"import plugin from 'babel-plugin-import-remove-resource-query'","symbol":"default","correct":"module.exports = require('babel-plugin-import-remove-resource-query')"},{"note":"Plugin has no options, so array form with empty args is valid but unnecessary.","wrong":"plugins: [['babel-plugin-import-remove-resource-query', { /* options */ }]]","symbol":"plugins","correct":"plugins: ['babel-plugin-import-remove-resource-query']"},{"note":"No import needed; plugin is loaded by Babel automatically.","symbol":"module syntax (no import needed)","correct":"Add to .babelrc or babel.config.js as a plugin string."}],"quickstart":{"code":"// babel.config.js\nmodule.exports = {\n  presets: ['@babel/preset-env'],\n  plugins: ['babel-plugin-import-remove-resource-query']\n};\n\n// input.js\nimport 'path/to/file?resourceQuery';\nimport foo from 'path/to/file?query';\nrequire('path/to/file?resourceQuery');\n\n// output.js\nimport 'path/to/file';\nimport foo from 'path/to/file';\nrequire('path/to/file');","lang":"javascript","description":"Shows usage in Babel config and transformation of imports/require removing query strings."},"warnings":[{"fix":"If needed, use a different approach or customize the plugin (not currently supported).","message":"Plugin strips ALL query parameters, including legitimate ones like ?inline for CSS.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Test with your Babel version; consider alternative if incompatibility arises.","message":"No version updates since initial release; may not support newer Babel versions.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install babel-plugin-import-remove-resource-query --save-dev' or 'yarn add --dev babel-plugin-import-remove-resource-query'.","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'babel-plugin-import-remove-resource-query'"},{"fix":"Use require() in babel config or rename file to .js and use module.exports.","cause":"Using ESM import in babel.config.js (e.g., .mjs) while plugin is CJS.","error":"require() of ES Module not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}