babel-plugin-import-remove-resource-query

Remove the resourceQuery param when importing modules via babel. Useful with Jest, that doesn't support resourceQueries

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-plugin-import-remove-resource-query
401.0.05 years ago5 years agoMinified + gzip package size for babel-plugin-import-remove-resource-query in KB

Readme

babel-plugin-import-remove-resource-query
Remove the resourceQuery param when importing modules via babel. Useful with Jest and babel-jest, that doesn't support resourceQueries

Example

import 'path/to/file?resourceQuery'
import foo from 'path/to/file?query'
import bar, { baz } from 'path/to/file?query'
require('path/to/file?resourceQuery')

becomes:
import 'path/to/file'
import foo from 'path/to/file'
import bar, { baz } from 'path/to/file'
require('path/to/file')

Installation

With npm do:
npm install babel-plugin-import-remove-resource-query --save-dev
With yarn do:
yarn add --dev babel-plugin-import-remove-resource-query

With babel-jest

In tour babelTransform.js file add the plugin like so:
module.exports = babelJest.createTransformer({
  plugins: [
    'babel-plugin-import-remove-resource-query'
  ]
})