LearnNewsExamplesServices
Frontmatter
id3173
titleapp worker build, workspace scope, windows
stateClosed
labels
bugwindowsstale
assigneestobiu
createdAtJun 21, 2022, 12:59 PM
updatedAtSep 15, 2024, 4:35 AM
githubUrlhttps://github.com/neomjs/neo/issues/3173
authortobiu
commentsCount3
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtSep 15, 2024, 4:35 AM

app worker build, workspace scope, windows

Closed v8.1.0 bugwindowsstale
tobiu
tobiu commented on Jun 21, 2022, 12:59 PM

Right now, the windows builds are running fine inside the framework scope, but they fail silently when running inside a neo workspace (npx neo-app).

The problem seems to be the combination of our app worker entry-point:

    importApp(path) {
        if (path.endsWith('.mjs')) {
            path = path.slice(0, -4);
        }

        return import(
            /* webpackInclude: /[\\\/]app.mjs$/ */
            /* webpackExclude: /[\\\/]node_modules/ */
            /* webpackMode: "lazy" */
            `../../${path}.mjs`
        );
    }

https://github.com/neomjs/neo/blob/dev/src/worker/App.mjs#L98

in combination with the ContextReplacementPlugin (webpack): https://webpack.js.org/plugins/context-replacement-plugin/

The relevant code is this one:

        plugins: [
            new webpack.ContextReplacementPlugin(/.*/, context => {
                if (!insideNeo && context.context.includes('/src/worker')) {
                    context.request = '../../' + context.request;
                }
            }),
            ...plugins
        ]

https://github.com/neomjs/neo/blob/dev/buildScripts/webpack/production/webpack.config.appworker.mjs#L135

Obviously we need to check for \\src\\worker and adjust context.request using the path nodejs API.

However, when adding testing logs, I saw that our one app worker based dynamic import to fetch potential app entry-points will get called twice inside the ContextReplacementPlugin. Even the same instance. so, instead of going up for another 2 folder levels, it will end up going up for 4 levels instead.

This might be a topic for @sokra.

As a workaround, we could adjust the code in a way, that context.request will only get modified once.

@Dinkh, @davhm: I could use your help on this one, since I no longer have Windows running inside a VM on my machine(s).

tobiu added the bug label on Jun 21, 2022, 12:59 PM
tobiu assigned to @tobiu on Jun 21, 2022, 12:59 PM
tobiu referenced in commit 31c8efa - "app worker build, workspace scope, windows #3173" on Jun 21, 2022, 3:27 PM
tobiu
tobiu Jun 21, 2022, 3:31 PM
tobiu added the windows label on Jul 4, 2022, 10:13 PM