GithubHelp home page GithubHelp logo

guoyu07 / rollup-plugin-includepaths Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dot-build/rollup-plugin-includepaths

0.0 0.0 0.0 20 KB

Rollup plugin to allow relative include paths in project files

JavaScript 100.00%

rollup-plugin-includepaths's Introduction

rollup-plugin-includepaths

Let you use relative paths in your import directives, like this:

// from src/lib/one/foo.js
import { Foo } from 'one/foo';

// from src/other/two/bar.js
import { Bar } from 'two/bar';

Setup

In your rollup configuration file:

import includePaths from 'rollup-plugin-includepaths';

let includePathOptions = {
    include: {},
    paths: ['src/lib', 'src/other'],
    external: [],
    extensions: ['.js', '.json', '.html']
};

export default {
    entry: './app.js',
    format: 'cjs',
    dest: 'public/app.min.js',
    plugins: [ includePaths(includePathOptions) ],
};

Options:

paths = ['']

An array of source paths in your project where the plugin should look for files

Example: ['src/lib', 'src/foo']

By default, resolve files from working dir

include

A map of module=>path/to/file.js with custom module paths. Used to override the search with a static path (like Browserify does with the "browser" config).

Use this option if you want to skip the file resolution and directly resolve a module name to a given path.

Example:

include: {
    // Import example: import angular from 'angular';
    'angular': 'bower_components/angular/angular.js'
}

external

An array of module names that should be excluded from the bundle (external modules).

By default, all the node built-in modules will be marked as external.

To include the built-ins, you can use the builtins plugin and set this config to an empty array.

Example:

// will not include the module 'angular' in the final bundle
external: ['angular']

extensions

An array of file extensions to look for in the project.

Default: ['.js', '.json']

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.