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

Parcel resolver fails dependency check when using i18nextify in a project #8834

Closed
Kilkenni opened this issue Feb 15, 2023 · 2 comments
Closed

Comments

@Kilkenni
Copy link

Kilkenni commented Feb 15, 2023

🐛 bug report

Building a static site with i18nextify fails if it is added via <script> tag into index.html.

🎛 Configuration (package.json)

...
"scripts": {
    "dev": "rm -rf dist/* && parcel src/*.html src/locales/*/*",
    "build": "rm -rf dist/* && parcel build src/*.html src/locales/*/* --public-url /my-site/"
  },
  "devDependencies": {
    "@parcel/transformer-sass": "^2.8.3",
    "parcel": "^2.8.3",
    "posthtml-include": "^1.7.4",
    "sass": "^1.58.0"
  },
  "dependencies": {
    "@mischnic/parcel-namer-preserve-structure": "^0.2.0",
    "i18nextify": "^3.2.3",
    "modern-normalize": "^1.1.0"
  }
...

.parcelrc :

{
	"extends": "@parcel/config-default",
	"namers": ["@mischnic/parcel-namer-preserve-structure", "..."],
  "transformers": {
    "*.json": ["@parcel/transformer-raw"]
  }
}

🤔 Expected Behavior

Prod version (parcel build) works similarly to dev version.

😯 Current Behavior

npm run dev works as expected, running the dev version. npm run build, however, doesn't.

The build fails with an error:

Flameshot_2023-02-15_21-42-11

adrai pointed out that dependency chain seems to be in order, so the problem is supposedly with Parcel's resolver.

💁 Workaround

I've tried importing i18nextify directly into JavaScript as suggested here instead of using <script> tag and the build apparently finished successfully.

Is it possible that resolver fails to find a dependency for script added via HTML tags, but works correctly when a script is added via import directly into index.js?

💻 Code Sample

<head>
...
<script src="/node_modules/i18nextify/i18nextify.min.js" type="module" id="i18nextify" fallbacklng="en"></script>
...
</head>

🌍 Your Environment

Software Version(s)
Parcel 2.8.3
Node 16.15.0
npm 9.4.0
Operating System Ubuntu 22.04.1 LTS
@mischnic
Copy link
Member

I don't get that error with your code snippet. Please provide a full reproduction.

@Kilkenni
Copy link
Author

I don't get that error with your code snippet. Please provide a full reproduction.

Kinda strange, because I tried reproducing it myself by reverting to import via <script>, but now it builds as usual in both cases.
I did many different things this weekend (including a minor Linux core upgrade), so I can't pinpoint what could have possibly fixed that. Sorry that I can't be of more help.

@mischnic mischnic closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants