Socket
Socket
Sign inDemoInstall

babel-plugin-transform-require-ignore

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-require-ignore

ignore the required file by extension type


Version published
Weekly downloads
10K
increased by16.03%
Maintainers
1
Weekly downloads
 
Install size
Created

Readme

Source

babel-plugin-transform-require-ignore

Build Status NPM Dependencies License

Since https://nodejs.org/api/globals.html#globals_require_extensions deprecated.

We have to find another way to ignore the extensions for webpack usage and make it work in node environment.

Configure it in .babelrc for node, we could ignore the requirement when run test in node or build server render app.

Then we run babel with BABEL_ENV=node will active this plugin;

{
  "env": {
    "node": {
      "plugins": [
        [
          "babel-plugin-transform-require-ignore",
          {
            "extensions": [".less", ".sass"]
          }
        ]
      ]
    }
  }
}

or use with babel-register in require-hooks

require('babel-register')({
  'plugins': [
    [
      'babel-plugin-transform-require-ignore',
      {
        extensions: ['.scss']
      }
    ]
  ]
});

Or with cli like other plugin used.

Notice:

Only ignore import './some.less'; or require('./some.less');

If assign to some variable, means that may use css-module, please use https://github.com/css-modules/css-modules-require-hook instead.

Keywords

FAQs

Package last updated on 25 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc