You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the problem you are having in as much detail as possible:
Compilation error with Webpack.
When using the bot normally it works totally fine but when compiling with Webpack (I use Typescript) I get the following error.
ERROR in ./node_modules/discord.js/src/index.js
Module not found: Error: Can't resolve '../package' in 'C:\workspace\EmojiQuiz\node_modules\discord.js\src'
@ ./node_modules/discord.js/src/index.js 21:11-32
@ ./src/DiscordServer.ts
@ ./src/Main.ts
Include a reproducible code sample here, if possible:
If needed I can set up a blank project with the same webpack config and basic setup tonight or tomorrow.
But here is my Webpack config. https://gist.github.com/Rojoss/38306aac843a4ddbcae5e1c641bbe268 ./node_modules/.bin/webpack --mode=development --progress --colors
Regarding the code I just copied the example which obviously works when I just run the js file with node.
constDiscord=require('discord.js');constclient=newDiscord.Client();client.on('ready',()=>{console.log(`Logged in as ${client.user.tag}!`);});client.on('message',msg=>{if(msg.content==='ping'){msg.reply('Pong!');}});client.login('...');
Further details:
discord.js version: 11.3.2
node.js version: 8.11.3
Operating system: Windows 10 x64
Priority this issue should have: normal
The text was updated successfully, but these errors were encountered:
Managed to fix it by fiddling around a bit with my Webpack config.
Turned out I had to add json to resolve array.
So if anyone else is ever having this issue this is how you can fix it.
Thanks @Rojoss I had the below error while trying to use the express-device package. It has code to require the package.json file to pull the version from it. And was getting the below error. Adding .json to the list of extensions fixed the problem.
require('../package').version Module not found: Error: Can't resolve '../package'
Please describe the problem you are having in as much detail as possible:
Compilation error with Webpack.
When using the bot normally it works totally fine but when compiling with Webpack (I use Typescript) I get the following error.
Include a reproducible code sample here, if possible:
If needed I can set up a blank project with the same webpack config and basic setup tonight or tomorrow.
But here is my Webpack config.
https://gist.github.com/Rojoss/38306aac843a4ddbcae5e1c641bbe268
./node_modules/.bin/webpack --mode=development --progress --colors
Regarding the code I just copied the example which obviously works when I just run the js file with node.
Further details:
The text was updated successfully, but these errors were encountered: