A
Alokai•15mo ago
mirza

How the __tests__ directories can be ignored while running yarn build in production mode.

I have tried .nuxtignore but this did not work. any idea? Thank you
28 Replies
skirianov
skirianov•15mo ago
can you tell me what integration you use, so I can give you exact answer
mirza
mirzaOP•15mo ago
Magento2 Integration for Vue Storefront 2
rohrig
rohrig•15mo ago
hi @mirza5339 👋 , please try add an ignore property in nuxt.config.js
export default {
// ...
ignore: [
'**/_tests_/**'
],
// ...
}
export default {
// ...
ignore: [
'**/_tests_/**'
],
// ...
}
Let me know if that does the trick. ah, you can put a minus - at the front of the filename and it will be ignored. what does your entry in the .nuxtignore look like? next idea:
build: {
extend(config, { isClient, isServer }) {
if (isClient || isServer) {
// Exclude _tests_ directories from being bundled into your production build
config.module.rules.push({
test: /_tests_/,
loader: 'null-loader'
});
}
}
},
build: {
extend(config, { isClient, isServer }) {
if (isClient || isServer) {
// Exclude _tests_ directories from being bundled into your production build
config.module.rules.push({
test: /_tests_/,
loader: 'null-loader'
});
}
}
},
mirza
mirzaOP•15mo ago
No description
rohrig
rohrig•15mo ago
ah I see what i just sent wont work based on the path of the test
mirza
mirzaOP•15mo ago
top is ignore rule from nuxt.config.js and at the bottom is example path The issue is that these test paths generate errors while running yarn build in production mode because devDependencies are not loaded in production mode Is this ignore rule correct?
rohrig
rohrig•15mo ago
The only part that might be incorrect is the dot . here:
No description
rohrig
rohrig•15mo ago
can you try it without that dot
mirza
mirzaOP•15mo ago
I have tried without dot it does not even consider the ignore config
rohrig
rohrig•15mo ago
I'm not sure at the moment. 🤔 Let me mess with it a bit and get back to you. If you figure it out in the meantime please let me know.
mirza
mirzaOP•15mo ago
ok thank you
rohrig
rohrig•15mo ago
I'm not getting any error when building. Can you tell me step by step how to reproduce the error? @mirza5339
mirza
mirzaOP•15mo ago
1. In you .env file change VSF_NUXT_APP_ENV=production
mirza
mirzaOP•15mo ago
2. Do you have a test folder path as shown in this attached screenshot
No description
mirza
mirzaOP•15mo ago
3. run command yarn build
rohrig
rohrig•15mo ago
No description
mirza
mirzaOP•15mo ago
yup
rohrig
rohrig•15mo ago
No description
rohrig
rohrig•15mo ago
no error. 🤔
mirza
mirzaOP•15mo ago
No description
rohrig
rohrig•15mo ago
try using WSL
mirza
mirzaOP•15mo ago
The errors shown are for devDependencies I tried on Digital Ocean app platform and had same issue
rohrig
rohrig•15mo ago
I'm not really familiar with Digital Ocean app platform please give WSL a try and let me know if that helps
mirza
mirzaOP•15mo ago
I dont know why it scans tests folders while running in production mode are you using any rule to ignore these folders?
rohrig
rohrig•15mo ago
I've done nothing at all to the config what's your yarn version? mein is 1.22.19
mirza
mirzaOP•15mo ago
same version
rohrig
rohrig•15mo ago
have you tried wsl?
mirza
mirzaOP•15mo ago
no The issue is no longer occurring after deleting everything and cloning the project from the repo again, but this time devDependencies were installed even though it was a production build. @skirianov Magento2 Integration for Vue Storefront 2 is not using .nuxtignore and the ignore rule in nuxt.config.js. I think this is a bug.
Want results from more Discord servers?
Add your server