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

Please upgrade to Webpack 5 #40

Open
budarin opened this issue Oct 13, 2020 · 18 comments
Open

Please upgrade to Webpack 5 #40

budarin opened this issue Oct 13, 2020 · 18 comments

Comments

@budarin
Copy link

budarin commented Oct 13, 2020

the current version is not compatible with Webpack 5

@daihaoxin
Copy link

daihaoxin commented Oct 31, 2020

In Webpack5, Use the following code to replace lines 119 and 120 of the project source file and recompile,

this._entryPoint = `${compilation.options.output.path}/${name}`;

@douglasgc
Copy link

douglasgc commented Nov 11, 2020

I published a new package with the name "start-server-nestjs-webpack-plugin" where this problem has been fixed. in case someone has the same need.

@igotfr
Copy link

igotfr commented Nov 13, 2020

start-server-nestjs-webpack-plugin

please, I install your package: npm i -D start-server-nestjs-webpack-plugin
and replace the third line of webpack-hmr.config.js but the problem persists

const StartServerPlugin = require("start-server-nestjs-webpack-plugin");

@douglasgc
Copy link

sends me his entire "webpack-hmr.config.js" so i can understand

@igotfr
Copy link

igotfr commented Nov 18, 2020

sends me his entire "webpack-hmr.config.js" so i can understand

const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const StartServerPlugin = require("start-server-nestjs-webpack-plugin");
//const StartServerPlugin = require('start-server-webpack-plugin');

module.exports = function(options) {
  return {
    ...options,
    entry: ['webpack/hot/poll?100', options.entry],
    watch: true,
    externals: [
      nodeExternals({
        allowlist: ['webpack/hot/poll?100'],
      }),
    ],
    plugins: [
      ...options.plugins,
      new webpack.HotModuleReplacementPlugin(),
      new webpack.WatchIgnorePlugin([/\.js$/, /\.d\.ts$/]),
      new StartServerPlugin({ name: options.output.filename }),
    ],
  };
};

@atassis
Copy link

atassis commented Dec 4, 2020

@douglasgc I have created strongly typed (typescript) repo with the fix provided, also cleaned the code so it is a bit more readable. Also it is quite disguising having a nestjs in name, so I changed a name to shorter and closer to behavior one- run-script-webpack-plugin. The GH repo is located here

@Pilo3369
Copy link

Pilo3369 commented Feb 7, 2021

Hi, I have followed all the change but still not working for me it's saying that:

Error The 'compilation' argument must be an instance of Compilation

(node:2593) [DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] DeprecationWarning: A 'callback' argument need to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.
(Use node --trace-deprecation ... to show where the warning was created)
node --trace-deprecation ...

Did I fail something or someone else have the same problem?

@atassis
Copy link

atassis commented Feb 8, 2021

@Pilo3369 there are no changes for more than a year. I advise you to use my fork of current repo (link above)

@Pilo3369
Copy link

Pilo3369 commented Feb 8, 2021

Hi thanks for the answer but I'm using your fork and I have this trouble with your fork :)

@Flo-D
Copy link

Flo-D commented Feb 11, 2021

@atassis I got the same issue as @Pilo3369 with your fork. The error seems to have been introduced with Webpack v5.10.0, it doesn't occur with v5.9.0.

Unfortunately, even if it compiles successfully with v5.9.0, I got the following error on file change:

/usr/src/app/node_modules/webpack/lib/logging/Logger.js:123
    throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`);
    ^

Error: No such label 'emitAssets' for WebpackLogger.timeEnd()
    at WebpackLogger.timeEnd (/usr/src/app/node_modules/webpack/lib/logging/Logger.js:123:10)
    at /usr/src/app/node_modules/webpack/lib/Watching.js:80:15
    at /usr/src/app/node_modules/webpack/lib/Compiler.js:757:14
    at eval (eval at create (/usr/src/app/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at /usr/src/app/node_modules/run-script-webpack-plugin/dist/index.js:64:17
    at EventEmitter.<anonymous> (/usr/src/app/node_modules/run-script-webpack-plugin/dist/index.js:108:13)
    at EventEmitter.emit (node:events:390:22)
    at online (node:internal/cluster/master:271:11)
    at Worker.onmessage (node:internal/cluster/master:265:5)
    at ChildProcess.onInternalMessage (node:internal/cluster/utils:48:5)
error Command failed with exit code 1.

@atassis
Copy link

atassis commented Feb 11, 2021

@Pilo3369 @Flo-D U would better create an issue then lol=)
I'll try to investigate it in next few days, but an issue and example will speed up my work in a matter of times

@atassis
Copy link

atassis commented Feb 12, 2021

@Flo-D can't get an error in this version webpack or even higher, so I definitely need an issue in my repo

@bkniffler
Copy link

@atassis Unfortunately you've been using the cluster (master) branch of this repository. If installed with beta tag, start-server-webpack-plugin uses child_process instead. The issue with clustering is, we can't use clusters within our own package, because the node process already is a child cluster.

@bkniffler
Copy link

Here is the issue: #12

@atassis
Copy link

atassis commented Feb 13, 2021

@bkniffler I'll look that through, but still wanna admit, that you can create an issue if something was done wrong in my repo

@bkniffler
Copy link

@atassis I've created a PR!

@atassis
Copy link

atassis commented Feb 13, 2021

Ok, thats kinda need some cleaning, but still nice
I'll fix and merge this in next few days

@Pilo3369
Copy link

Thanks, @atassis looks like it's work at least I don't have the same issue but don't know from where it's come so I write it here for now: Error: [HMR] Hot Module Replacement is disabled.
An idea?

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

No branches or pull requests

8 participants