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

Webpack v4 plugin support #240

Closed
switz opened this issue Mar 14, 2018 · 8 comments · Fixed by #249
Closed

Webpack v4 plugin support #240

switz opened this issue Mar 14, 2018 · 8 comments · Fixed by #249

Comments

@switz
Copy link

switz commented Mar 14, 2018

Please provide a description of the bug / issue, and provide the details below:

I'm seeing these deprecation warnings when running webpack-dashboard in webpack v4 with process.traceDeprecation = true; in my webpack config:

$ node_modules/.bin/webpack-dev-server --config ./webpack.config.js
(node:16541) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
    at DashboardPlugin.apply (/Users/daniel/y/iui/node_modules/webpack-dashboard/plugin/index.js:98:14)
    at webpack (/Users/daniel/y/iui/node_modules/webpack/lib/webpack.js:37:12)
    at startDevServer (/Users/daniel/y/iui/node_modules/webpack-dev-server/bin/webpack-dev-server.js:379:16)
    at processOptions (/Users/daniel/y/iui/node_modules/webpack-dev-server/bin/webpack-dev-server.js:361:5)
    at Object.<anonymous> (/Users/daniel/y/iui/node_modules/webpack-dev-server/bin/webpack-dev-server.js:504:1)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:617:3
(node:16541) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
    at DashboardPlugin.apply (/Users/daniel/y/iui/node_modules/webpack-dashboard/plugin/index.js:117:14)
    at webpack (/Users/daniel/y/iui/node_modules/webpack/lib/webpack.js:37:12)
    at startDevServer (/Users/daniel/y/iui/node_modules/webpack-dev-server/bin/webpack-dev-server.js:379:16)
    at processOptions (/Users/daniel/y/iui/node_modules/webpack-dev-server/bin/webpack-dev-server.js:361:5)
    at Object.<anonymous> (/Users/daniel/y/iui/node_modules/webpack-dev-server/bin/webpack-dev-server.js:504:1)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:617:3

I'm also seeing a lot of Worker error Error: No code sections found but I see that is being discussed in #234.

====================================================================

Steps to reproduce the problem

Add new DashboardPlugin() to plugins in webpack v4.

====================================================================

More Details
  • What operating system are you on?
    OS X 10.12
  • What terminal application are you using?
    iTerm 2
  • What version of webpack-dashboard are you using?
    1.1.1
  • What is the output of running echo $TERM?
    xterm-256color
@ryan-roemer
Copy link
Member

ryan-roemer commented Mar 14, 2018

Haven't even looked at this yet, but guessing we'll need something analogous to: https://github.com/FormidableLabs/webpack-stats-plugin/blob/master/lib/stats-writer-plugin.js#L60-L66

  apply(compiler) {
    if (compiler.hooks) {
      compiler.hooks.emit.tapPromise("stats-writer-plugin", this.emitStats.bind(this));
    } else {
      compiler.plugin("emit", this.emitStats.bind(this));
    }
  }

@jharris4
Copy link

jharris4 commented Apr 9, 2018

FYI a plugin I maintain started giving the Tapable.apply is deprecated warning after upgrading to webpack 4, and I managed to find the commit to webpack where they updated all the internal plugins to fix that:

webpack/webpack@7dd41b5#diff-5d04086b4365820a456acec22b899956

@IamCarbonMan
Copy link

Is this bug going to be looked at further? It's been broken for several months now and essentially makes this entire repo deprecated, since the webpack community has basically fully migrated to webpack v4.

@ryan-roemer
Copy link
Member

ryan-roemer commented May 3, 2018

Yes, I've been working on the inspectpack port to a completely new version for longer than this issue is open and going to bring that (as the underlying engine to webpack-dashboard) to webpack-dashboard soon. (Things will also get a lot faster as the new inspectpack uses only the stats object instead of the raw bundle).

In the meantime @IamCarbonMan , we'd be open to a stop-gap PR to adjust the plugin hooks for webpack@v4 compatibility. ( Note: that this would only make webpack-dashboard not raise the deprecation warning, it doesn't help with code sections found issues because of the new bundle structure in webpack4 that our work on new inspectpack will address).

@IamCarbonMan
Copy link

I'll try and submit something just to make things work for now. Hopefully the underlying stuff works out before too long.

@sunny920406
Copy link

mark

@ztoben
Copy link

ztoben commented May 17, 2018

@IamCarbonMan, I can put in a PR if you don't have time to get one in. Just don't want to work on one if you've started it already.

@ryan-roemer
Copy link
Member

HI Folks, I've actually just started working on this a day ago as inspectpack@3 is almost ready (one more feature PR and should be good to go -- it's been in a private repo, hence lack of visibility). I'll take this on as part of part of the integration of the new inspectpack.

It may still be a week or two depending on my free time, but this is literally what I'm working on now, so thanks all around for your patience.

(As a helpful teaser, the new inspectpack has way fewer dependencies (no binary deps anymore), is tested for all webpack versions 1-4, and is way, way, way faster).

@ryan-roemer ryan-roemer self-assigned this May 17, 2018
ryan-roemer added a commit that referenced this issue May 24, 2018
…249)

This is a major update to `webpack-dashboard` with breaking changes. And a lot of speed and coolness.

## Breaking changes

- Requires node6+.
- Use the webpack internal stats object instead of real bundles. This is faster and with less futzing / parsing on the dashboard's end. Should permanently fix the `no code sections` found errors.
- We've removed command flags / plugin options that no longer apply like `--root`, etc.

### Modules

- Removed `min` and `min+gz` estimated file sizes from modules outputs. This dramatically speeds up the dashboard and reduces CPU usage.

### Versions

- Version skews should be detected more accurately and much faster thanks to dramatically improved heuristics from `inspectpack`.

### Duplicates

- Duplicates now reports on duplicate files that are (1) completely identical, and (2) the same package name and file path but with different sources. The first are low hanging fruit for optimizations in your build -- you've literally got the same thing multiple times. The latter needs to be coalesced at the package dependency level -- something the versions output can help with.

## Issues

- Upgrade hooks to work in webpack1-4 with abstraction. Fixes #240

## Refactoring

- Switch from `chalk` to using Blessed's built-in tags for coloring. This is definitely the way to go as things like table spacing don't work with chalk strings and work like a charm with Blessed tags.
- Update dependencies and remove lots of unused things (like `lodash`, `chalk`, `bluebird` and a whole lot of `babel*` that apparently wasn't used anyways).
    - New `inspectpack` is way slimmer and faster, with no more binary dependencies!
- Switch to yarn-only workflow in dev.
- Bump Travis node versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants