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

The conditions do not work "automatically" #7

Closed
pierrewtLanca opened this issue Jan 31, 2022 · 1 comment
Closed

The conditions do not work "automatically" #7

pierrewtLanca opened this issue Jan 31, 2022 · 1 comment

Comments

@pierrewtLanca
Copy link

pierrewtLanca commented Jan 31, 2022

Hello,

Thanks for the tool that is a great way to deal with conditional rendering.
We use the conditional rendering in a Vue project to conditionally generate some parts in Vue components and in javascript files.

We have an issue though to generate the conditional rendering "automatically": when we want to switch from one condition to the other, compiling the code again (using npm run serve --optionX) will not make a difference. To apply the condition, we have to make a change in each files containing the directive /*IFTRUE_XXX (a space after the directive for example), then save. The next compilation will produce the code as expected.

I'm not sure if that's a bug or a problem from our setup?

Here is the extract our vue.config.json

module.exports = {
    /* IFTRUE_isMicrobit */
    configureWebpack: {
        devtool: "source-map",
        plugins: [
            new MoveAssetsPlugin({
                clean: true,
                patterns: [
                    {
                        from: "dist/pythonLib",
                        to: "dist/",
                    },
                ],
            }),
        ],
    },
    /* FITRUE_isMicrobit */   
    chainWebpack: (config) => {
        config.module
            .rule("conditionalCompilerVue")
            .test(/\.vue$/)
            .use("vue-loader")
            .loader("js-conditional-compile-loader")
            .options( {
                isPurePython: process.env.npm_config_python,
                isMicrobit: process.env.npm_config_microbit,
            });
        config.module
            .rule("conditionalCompilerTS")
            .test(/\.ts$/)
            .use("vue-loader")
            .loader("js-conditional-compile-loader")
            .options( {
                isPurePython: process.env.npm_config_python,
                isMicrobit: process.env.npm_config_microbit,
            });
    },
    publicPath: (process.env.npm_config_python)?"/editor/":"/microbit/",
    pluginOptions: {
        i18n: {
            locale: "en",
            fallbackLocale: "en",
            localeDir: "localisation",
            enableInSFC: false,
        },
    },
}

Thank you so much for your help - if any other file is needed to explore this issue, please let me know

@pierrewtLanca
Copy link
Author

Hi,
A small update, after reading more about vue cli: as explained in their documentation, the serve command is by default using the cache-loader: so clearing nodes/.cache sorted this issue.
It was due to the cache..

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

No branches or pull requests

1 participant