New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dvhb/craco-extend-scope

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dvhb/craco-extend-scope

An extend scope plugin for craco / react-scripts / create-react-app

1.0.1
latest
Source
npm
Version published
Maintainers
4
Created
Source

Craco extend scope plugin

By default create-react-app don't allow you to import modules outside of /src dir, it throws error like this: Relative imports outside of src/ are not supported. This plugin extends CRA config to add custom paths to ModuleScopePlugin.

Supported Versions

craco-extend-scope is tested with:

  • react-scripts: ^2.1.5
  • @craco/craco: ^3.5.0

Installation

First, follow the craco Installation Instructions to install the craco package, create a craco.config.js file, and modify the scripts in your package.json.

Then install craco-extend-scope:

$ npm i @dvhb/craco-extend-scope

# OR

$ yarn add @dvhb/craco-extend-scope

Usage

Here is a complete craco.config.js configuration file that extends scope of create-react-app:

const cracoExtendScope = require('./craco-extend-scope');

module.exports = {
  plugins: [{ plugin: cracoExtendScope, options: { path: 'static' } }]
};

Now you can use absolute import in you code like this:

import 'static/styles.css';

FAQs

Package last updated on 21 Mar 2019

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