Code Monkey home page Code Monkey logo

Comments (5)

ryan-roemer avatar ryan-roemer commented on June 10, 2024

Could you provide a minimal sample repository showing what you’re trying / would want to work?

from webpack-dashboard.

Saikedo avatar Saikedo commented on June 10, 2024

So basically this is what I am trying (Not my actual setup, just a bare minimum to show the steps)

//webpack.prod.ts
const DashboardPlugin = require('webpack-dashboard/plugin');
...

const prodConfig: webpack.Configuration = {
  mode: 'production',
  devtool: 'source-map',
  entry: {
    ...
  },
  output: {
   ...
  },
  plugins: [
    new DashboardPlugin(),
  ],
};

export default prodConfig;

and then I have this file that handles the build process(Not using a cli because the actual file does much more than shown here)

//buildWeb.ts

webpack(webpackConfig, (error, stats) => {
     console.warn('Success\n', stats.toString());
});

And in my package.json, I execture my buildWeb.ts by doing

"build-web": "npx ts-node src/scripts/buildWeb.ts",

This structure currently does not display anything inside the console.

one possible approach would be to be able to pass a callback to DashboardPlugin that will return something that I can use to construct the dashboard in the console window. I was initially thinking handler option is exactly for that but I was unable to leverage that in any meaningful way.

from webpack-dashboard.

Saikedo avatar Saikedo commented on June 10, 2024

I actually just realized that adding the following to my buildWeb.ts starts displaying the dashboard, but the dashboard just shows up empty and does not update the elements.

const Dashboard = require('webpack-dashboard/dashboard/index');
const dashboard = new Dashboard ();

// and then use the plugin with
new DashboardPlugin(dashboard.setData),

from webpack-dashboard.

ryan-roemer avatar ryan-roemer commented on June 10, 2024

I have an example running the dashboard from a TS config webpack config file for this PR: #341

Just checkout the repository and run yarn dev-ts. You can look at what that command has in it as well as the example TS config file there for your reference.

If you're still hitting an error, can you please open up a minimal repository with what you'd expect (or like) to work as an example, so I can install + build and see the failure myself? This makes it much easier to debug rather than guessing as to your setup... Thanks!

from webpack-dashboard.

ryan-roemer avatar ryan-roemer commented on June 10, 2024

Oh, reading this more -- the dashboard currently relies on inter-process communication between a webpack process and the dashboard (really a websocket server that pretty prints stuff).

Maybe what you need is something like:

"build-web": "webpack-dashboard -- ts-node src/scripts/buildWeb.ts"

from webpack-dashboard.

Related Issues (20)

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.