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

feat(plugin-legacy): add protocol to support file protocol #1189 #2574

Closed
wants to merge 1,288 commits into from

Conversation

ariesjia
Copy link

Fix #1189

@Shinigami92 Shinigami92 added 🔍 review needed plugin: legacy p2-nice-to-have Not breaking anything but nice to have (priority) enhancement New feature or request labels Mar 21, 2021
@L-Chris
Copy link

L-Chris commented Mar 22, 2021

I need this PR, too.
But it should not just replace code in the output html. Need a better implementation to do it?

@ariesjia
Copy link
Author

@L-Chris replace code is for remove the ESM script entry, file protocol not support ESM due to cross origin request.

@shadow-light
Copy link

I also need this, but it's for electron so I don't need all the other aspects of plugin-legacy. I got a build that's compatible with the file protocol with the following config:

return {
    base: './',
    plugins: [
        plugin_iife(),
    ],
    build: {
        rollupOptions: {
            output: {
                format: 'iife',  // Make whole module self-executing fn rather than real module
                manualChunks: () => 'everything.js',  // Hack to force all imports into one file
            },
        },
    },
}

And created the following plugin to stop the browser treating the script like a module:

export default function(){

    return {
        name: 'iife',
        apply: 'build',
        enforce: 'post',

        transformIndexHtml(html){
            return html.replace(' type="module" crossorigin ', ' ')
        }
    }
}

@koenoe
Copy link

koenoe commented Jan 4, 2022

What's blocking this PR from getting merged? File protocol support would be super useful, i.e. for Tizen Web applications.

sapphi-red and others added 24 commits August 10, 2022 21:51
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
@Sovai
Copy link

Sovai commented Nov 14, 2022

I can't use vite on my project because of this issue. Please why this PR cannot be merged?

@Mileber
Copy link

Mileber commented Nov 14, 2022 via email

@Mileber
Copy link

Mileber commented Apr 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p2-nice-to-have Not breaking anything but nice to have (priority) plugin: legacy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to use production version as local app ( file:/// )