-1

I am trying make a small webpage, and I am trying to program with modern javascript/html and css features, but the browser that this code is going to go on, is ultimately a very old browser where most of the features are not supported.

I am trying to use parceljs to transcibe the code into an older version, but even that code does not work, or at the very least, I cannot manage to setup parcel in such a way that the code works.

I have attempted to make a very small test project with an import statement that I know will fail:

"import {script} from './file/folder.js'; "

After running parcel, the code still fails. I have downloaded Chromium 53 to test with (Not chrome 53), and on that browser the code fails on an async method, which wasn't supposed on these browsers either.

I have tried to put a .browserslistrc file where my entry point is, where I have written various things such as "since 2010", "chrome 53" etc, and it fails everytime.

I am honestly unsure if parcel is even using the file. I am a beginner in web coding.

Is there anything specific I am overlooking?

If I contain this in my index.html file, and the script only changes color, it will wail on the import statement.

<script type="module">
import {colorChanger} from './assets/colorChanger.js'; 

const button = document.getElementById("button");
button.addEventListener("click", clickButton);

function clickButton()
{
    colorChanger.changeColor();
}

</script>

After transcribing using parcel, and running the file:

It will then fail on the code below. Now this exists is in the transcibed code, and there are many more lines of code in this file.

 ws.onmessage = async function(event /*: {data: string, ...} */ )
Somecode
  • 15
  • 1
  • 4
  • 3
    Chrome 53 has a usage of ~0.01% ([source](https://caniuse.com/usage-table)). Why would you want to support that browser? – JSON Derulo Aug 25 '23 at 07:59
  • They are likely running on Windows NT or something – mplungjan Aug 25 '23 at 08:04
  • Please read [ask]. “The code still fails” is not enough for us to go on. You also need to provide a [mcve]. – Quentin Aug 25 '23 at 08:05
  • Because I am trying to develop for an app that runs that specific version 53 internally. Now of course, I am not the owner of the app or anything so I cannot change the version, or know when they will update it. – Somecode Aug 25 '23 at 08:06
  • “the code fails on an async method, which wasn't supposed on these browsers either” — you should probably focus on that rather than the import statement! – Quentin Aug 25 '23 at 08:08
  • @Quentin I agree, but is there any magic tricks I can do in parcel to support that old browsers? I am also pretty new to parcel, and I am wondering if have to try use something else like webpack instead. – Somecode Aug 25 '23 at 08:17

0 Answers0