Hi,
I'm trying to learn how to build a website. For that, i choosed laravel 9 /vuejs 3.
I would like to use minecraft-query to query information from minecraft server.
PS F:\Web\new\stri-site> npm run dev) [DEP0164] DeprecationWarning: Implicit coercion to integer for exit code is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
> dev
> npm run development
> development
> mix && vite
โ Mix
Compiled with some errors in 1.70s
ERROR in ./node_modules/minecraft-query/Query.js 1:12-28
Module not found: Error: Can't resolve 'dgram' in 'F:\Web\new\stri-site\node_modules\minecraft-query'
ERROR in ./node_modules/minecraft-query/Query.js 3:15-32
Module not found: Error: Can't resolve 'crypto' in 'F:\Web\new\stri-site\node_modules\minecraft-query'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
webpack compiled with 2 errors
Here is my package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix && vite",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production && vite build",
"build": "vite build"
},
"devDependencies": {
"@popperjs/core": "^2.10.2",
"@tailwindcss/forms": "^0.5.2",
"@vitejs/plugin-vue": "^3.0.1",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.4.2",
"axios": "^0.25",
"bootstrap": "^5.2.1",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"postcss": "^8.4.6",
"sass": "^1.32.11",
"tailwindcss": "^3.1.0",
"vue": "^3.2.37",
"vue-loader": "^16.8.3"
},
"dependencies": {
"crypto-browserify": "^3.12.0",
"laravel-vite-plugin": "^0.7.1",
"minecraft-query": "^1.0.13",
"minerender": "^1.4.6",
"node-polyfill-webpack-plugin": "^2.0.1",
"vue": "^3.2.45",
"webpack": "^5.75.0"
}
}
My issue is that i can't compile mix because of this polyfill.
I've already checked google but find something with the same configuration is really hard. Everyone talk about a webpack.config.js,
I find one in my node modules : /node_modules/laravel-mix/setup/webpack.config.js ?
const { assertSupportedNodeVersion } = require('../src/Engine');
module.exports = async () => {
// @ts-ignore
process.noDeprecation = true;
assertSupportedNodeVersion();
// write module export for webpack env to resolve fallback
const mix = require('../src/Mix').primary;
require(mix.paths.mix());
await mix.installDependencies();
await mix.init();
return mix.build();
};
Where should i write this 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }' ?
If you need more information, don't hesitate !
Thank's in advance !