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

out-file option does not respect given file-extension #1228

Closed
lqdchrm opened this issue Apr 21, 2018 · 2 comments · Fixed by #1229
Closed

out-file option does not respect given file-extension #1228

lqdchrm opened this issue Apr 21, 2018 · 2 comments · Fixed by #1229

Comments

@lqdchrm
Copy link
Contributor

lqdchrm commented Apr 21, 2018

🐛 bug report

🎛 Configuration (.babelrc, package.json, cli command)

parcel build index.html --out-file index.aspx

🤔 Expected Behavior

The generated file should be ./dist/index.aspx

😯 Current Behavior

The generated file is ./dist/index.aspx.html

💁 Possible Solution

In Bundle.js@line_121 when checking for the outFile options, check for given file extension for example like so:

// Parcel version: 1.7.1 File: Bundle.js Line: 121
// If this is the main entry file, use the output file option as the name if provided.
    if (isMainEntry && entryAsset.options.outFile) {

      let _ext = Path.extname(entryAsset.options.outFile);
      if (_ext && _ext.length > 0) {
        ext = _ext;
        name = Path.basename(entryAsset.options.outFile, ext)
      } else {

        name = entryAsset.options.outFile

      }
    }

🔦 Context

I would like the generated file to have "aspx" as file-extension

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 1.7.1
Node 9.4.0
npm/Yarn npm 5.6.0
Operating System Windows 10 x64
@DeMoorJasper
Copy link
Member

DeMoorJasper commented Apr 22, 2018

Not sure if this should be done. I think parcel should stay responsible for extensions.
However in my opinion, we should strip of the extension and replace it with parcel's extension, this is currently not the case.
I think in your case you should probably need multiple entrypoints and have your aspx file point to the various js and css bundles you use

@lqdchrm
Copy link
Contributor Author

lqdchrm commented Apr 28, 2018

Thanks for your feedback. I agree on parcel being responsible for extensions in general.

My point is, that if you explicitly set the output filename via --out-file, i would expect that the given file-extension is respected. But never mind, if it doesn't fit with the overall concept, I'm ok with that :-)

Feel free to close this issue then.

For my use-case I happily can setup a build-toolchain and rename the rename the file after parcel has run (but isn't the whole point of parcel not to set-up custom toolchains ;-) ?

UPDATE: I will test your proposal about having multiple entry-points and linking from a non-parcel touched aspx-file. My use-case currently is, that there's nothing special about the aspx-file, it's plain html, but hosting in sharepoint requires the file-extension being aspx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants