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

[issue] Build for really old Browsers #309

Open
jeff-hykin opened this issue Mar 15, 2022 · 9 comments
Open

[issue] Build for really old Browsers #309

jeff-hykin opened this issue Mar 15, 2022 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@jeff-hykin
Copy link
Contributor

Inital Issue

Screen_Shot_2022-03-15_at_10 25 59_AM

Browser results
Screen Shot 2022-03-15 at 11 28 20 AM

@marc2332 marc2332 self-assigned this Mar 15, 2022
@marc2332 marc2332 added the bug Something isn't working label Mar 15, 2022
@jeff-hykin
Copy link
Contributor Author

jeff-hykin commented Mar 15, 2022

I targeted es2016 with vite and tsconfig although I'm having a hard time confirming that its actually compiling to es2016

(and the errror persists)

import { defineConfig } from 'vite'
import typescript from '@rollup/plugin-typescript'
import path from 'path'

export default defineConfig((configEnv) => ({
  clearScreen: false,
  build: {
    target: "es2016",  // CHANGE_1
    sourcemap: false,  // CHANGE_2
    lib: {
      entry: path.resolve(__dirname, 'src/index.ts'),
      name: '@gveditor/web_components',
      fileName: (format) => `index.${format}.js`
    },
    rollupOptions: {
      external: ['react', 'styled-components'],
      output: {
          "format":"iife" // CHANGE_3
      },
      plugins: [
        typescript({ tsconfig: './tsconfig.json' })
      ]
    }
  }
}));

@marc2332
Copy link
Member

I am not sure yet, but, I think this might also happen on Linux, I still have to try it.

@jeff-hykin
Copy link
Contributor Author

jeff-hykin commented Mar 20, 2022

Yeah I'm pretty sure the issue is that vite is still not converting to es2016. There are still <script type=module> tags which are a recent feature, and it's also keeping all the import statements.

In the index.html I took the type=module away from the index.tsx and it produces a new error based on failing at the first import statement.

I tried tracking down where the transpiled files were (more than just the ones inside web_components/dist). I copied some source stuff from the app window, and did a full recursive content search but nothing turned up which was really strange. So I have no idea where vite it storing the compiled version of main.tsx.

@jeff-hykin
Copy link
Contributor Author

jeff-hykin commented Mar 20, 2022

I also tried tracking down how to properly target es2016 with vite, but documentation is quite parse on the subject. I can't find any open issues or examples either.

I'm thinking of

  1. Trying to run parcel to see how that goes
  2. Starting a small vite project to make sure I'm setting the options right

But I haven't gotten around to either of those yet

@marc2332
Copy link
Member

marc2332 commented Apr 2, 2022

Linux

Update: I just tried on Linux and it seems to work fine on a new Fedora 36

@jeff-hykin
Copy link
Contributor Author

jeff-hykin commented Apr 3, 2022

on that system, If you do inspect element and look at the HTML, are there any scripts with module tags?

@marc2332
Copy link
Member

marc2332 commented Apr 3, 2022

Yes, as expected
image

on that system, If you do inspect element and look at the HTML, are there any scripts with module tags?

@marc2332
Copy link
Member

marc2332 commented Apr 3, 2022

To be honest, I think what really matters is making sure the release version actually works

@jeff-hykin
Copy link
Contributor Author

I'll see if I can do a full build next time I'm in the code.

I've been working on a Tauri template repo (even before I found Gravitron) and I'm finding/solving a lot of system issues, which might be relevant to this.

@marc2332 marc2332 changed the title Build for really old Browsers [issue] Build for really old Browsers Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants