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

Build fails with 'filePath' of 'bundle.getMainEntry(...)' as it is undefined. #3

Open
kohki-shikata opened this issue Jun 24, 2021 · 4 comments

Comments

@kohki-shikata
Copy link

Hi.

When I hit the command serve or build parcel ./src/index.pug, an error occurs.

Error messages below:

🚨 Build failed.
parcel-namer-custom: Cannot destructure property 'filePath' of 'bundle.getMainEntry(...)' as it is undefined.

parcel version -> 2.0.0-beta.3.1
parcel-namer-custom version -> 0.2.0

Here is .parcelrc

{
    "extends": "@parcel/config-default",
    "namers": ["parcel-namer-custom", "..."],
}

Here is partial of package.json related this plugin

    "parcel-namer-custom": {
        "src/index.pug$": "[name].[type]",
        ".(pug|html)$": "[dir]/[name].[type]",
        ".(js|ts)$": "[dir]/[name].[type]",
        ".styl$": "[dir]/[name].[type]",
        ".(jpg|gif|png|webp|svg)$": "[dir]/[name].[type]",
        ".jsx?$": "scripts/[name].[hash].[type]"
    },
@kohki-shikata
Copy link
Author

Update:

I load css files in app.js like below.

// head of app.js
import "normalize.css/normalize.css"
import '../css/style.styl' // this is my custom css file.
import 'swiper/swiper-bundle.css'
import Swiper from 'swiper/bundle'

and I let them to be commented out.

// import "normalize.css/normalize.css"
// import '../css/style.styl' // this is my custom css file.
// import 'swiper/swiper-bundle.css'
import Swiper from 'swiper/bundle'

BOOM! Terminal said

parcel-namer-custom: src/index.pug → dist/index.html
/Users/kohkishikata/git-repo/the_repository/src/index.pug
parcel-namer-custom: src/assets/img/logowa.png → assets/img/logowa.png
/Users/kohkishikata/git-repo/the_repository/src/assets/img/logo_wa.png
parcel-namer-custom: src/assets/js/app.js → assets/js/app.js
/Users/kohkishikata/git-repo/the_repository/src/assets/js/app.js

Almost workaround what I expected.

However, I still need to use css in app.js and use npm modules.

Does anyone have any solution?

@JaredSartin
Copy link

I am hitting this too, but mine seems to be with including another local JS file.

ap-- added a commit to ap--/parcel-namer-custom that referenced this issue Oct 5, 2021
@usagi
Copy link

usagi commented Dec 15, 2021

Hey guys, have any progress? I'm hitting the issue too. 😢

@qlaueen
Copy link

qlaueen commented Jan 17, 2024

hey, any progress on this? i am facing the same problem

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

4 participants