import-deps

1.1.5 • Public • Published

import-deps

A tool to import webpack bundled dependencies based on one file

Installation

npm install import-deps -g

Usage

To use import-deps first cd into the directory where the file you want to import lives

Example

cd myapp/media/
 
ls
index.js component.jsx component.less constants

In the command line, write import-deps and the file name you would like to import

import-deps index.js

import-deps will check if the file exists in the folder you are in and then prompt you for three configurations

  1. Where the webpack config files lives
  2. An export name for the config file (will just use the default exported config if nothing is specified)
  3. Where you would like to write the file and its dependencies to
prompt: Please point to apps webpack config: '/myapp/lib/webpack.config.js'
prompt: Please specify export name (if any): ''
prompt: Where do you want to write the imported dependencies?:  '/newapp/imported'

After the process is complete, the file and all its dependencies will be saved in the folder specified (in this case /newapp/imported)

Dependencies

webpack

import-deps assumes that you are using webpack to bundle your JS files. If you do not use webpack, this tool will not work for your build. Before importing a file from your project, make sure you run npm install on the project to bring in all the necessary webpack loaders and plugins

npm packages

When finishing an import, the importer does not automatically install npm packages that your imported files depend on. This is a feature that has yet to be implemented. For now, after the build is done, the console will print all the dependencies within the project's node_modules

Resolves

If you still have errors in your webpack build that are not related to npm packages it most likely due to your resolve config. Make sure your resolves within your new project take into account the resolves from the previous project you imported from.

License

MIT License, see LICENSE for details

Readme

Keywords

none

Package Sidebar

Install

npm i import-deps

Weekly Downloads

1

Version

1.1.5

License

ISC

Last publish

Collaborators

  • chuckpierce