Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate npm packages in webpack #1538

Closed
js08 opened this issue Oct 22, 2015 · 2 comments
Closed

integrate npm packages in webpack #1538

js08 opened this issue Oct 22, 2015 · 2 comments
Labels

Comments

@js08
Copy link

js08 commented Oct 22, 2015

I have a sample app is it possible to integrate depcheck-es6 package in the below app

https://github.com/rackt/redux/tree/master/examples/todomvc

so that I dont need to run depcheck-es6 in my terminal everytime and I can make it to automate.
I looked at API section but not sure how to do it. Is it possible to integrate in webpack to

var path = require('path');
var depcheck = require('depcheck-es6');

var options = {
  withoutDev: false, // check against devDependencies
  ignoreBinPackage: false, // ignore the packages with bin entry
  ignoreDirs: [ // folder with these names will be ignored
    'sandbox',
    'dist',
    'bower_components'
  ],
  ignoreMatches: [ // ignore dependencies that matches these globs
    'grunt-*'
  ],
  parsers: { // the target parsers
    '*.js': depcheck.parser.es6,
    '*.jsx': depcheck.parser.jsx
  },
  detectors: [ // the target detectors
    depcheck.detector.requireCallExpression,
    depcheck.detector.importDeclaration
  ],
  specials: [ // the target special parsers
    depcheck.special.eslint,
    depcheck.special.webpack
  ]
};

depcheck('/path/to/your/project', options, function(unused) {
  console.log(unused.dependencies); // an array containing the unused dependencies
  console.log(unused.devDependencies); // an array containing the unused devDependencies
  console.log(unused.invalidFiles); // files that cannot access or parse
  console.log(unused.invalidDirs); // directories that cannot access
});
@bebraw
Copy link
Contributor

bebraw commented Nov 16, 2015

Perhaps it would be smarter to solve this problem outside of webpack? Set up a custom npm script for it for example. You can trigger the script through your CI or something like git-prepush-hook to match that automation requirement.

@bebraw
Copy link
Contributor

bebraw commented Apr 9, 2016

You probably should push this to a plugin or a loader. See npm-install-webpack-plugin and eslint-loader for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants