question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Providing __system_context__ when an entry point sets library.type = 'system'

See original GitHub issue

Bug report

What is the current behavior?

When setting library.type per entry point, __system_context__ is not set for SystemJS entry points and compilation sometimes fails.

If the current behavior is a bug, please provide the steps to reproduce.

The easiest way to reproduce this is by changing the test in configCases/target/system-context.

The original config:

/** @type {import("../../../../").Configuration} */
module.exports = {
    output: {
	library: {
	    type: "system"
	}
    },
    node: {
	__dirname: false,
	__filename: false
    }
};

I would expect the following config to behave the same:

/** @type {import("../../../../").Configuration} */
module.exports = {
    entry: {
        main: {
	    import: "./index.js",
	    library: {
		type: "system"
	    }
	}
    },
    node: {
	__dirname: false,
	__filename: false
    }
};

But it causes an error:

TypeError: Cannot read property 'type' of undefined

      219 | 				.for(RuntimeGlobals.systemContext)
      220 | 				.tap("RuntimePlugin", chunk => {
    > 221 | 					if (compilation.outputOptions.library.type === "system") {
          | 					                                      ^
      222 | 						compilation.addRuntimeModule(
      223 | 							chunk,
      224 | 							new SystemContextRuntimeModule()

      at lib/RuntimePlugin.js:221:44
      at Hook.eval (eval at create (node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:13:16)
      at Hook.CALL_DELEGATE [as _call] (node_modules/tapable/lib/Hook.js:14:14)
      at Compilation.processRuntimeRequirements (lib/Compilation.js:2848:7)
      at lib/Compilation.js:2477:12
      at lib/Compilation.js:2680:5
      at node_modules/neo-async/async.js:2818:7
      at done (node_modules/neo-async/async.js:3522:9)
      at lib/Compilation.js:2660:7
      at lib/Compilation.js:2748:32

If there is another library.type set under output then the compilation is successful, but __system_context__ is undefined when running the application.

What is the expected behavior?

Compilation does not fail when output.library.type is not set. __system_context__ is available for entry points with library.type = 'system'.

Other relevant information: webpack version: 5.40.0 Node.js version: 14.17.0 Operating System: macOS 11.4 Additional tools:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
cjpearsoncommented, Jun 25, 2021

It looks like the docs already mentioned that it’s deprecated. I think the test was written before that though.

0reactions
alexander-akaitcommented, Sep 30, 2021

bump

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to model an extended system context with SysML
The simple system context is easy to create, a good starting point and perfect for the communication with the stakeholders.
Read more >
The C4 model for visualising software architecture
Level 1: A System Context diagram provides a starting point, showing how the software system in scope fits into the world around it....
Read more >
Create applications - Configuration Manager - Microsoft Learn
In the Configuration Manager console, go to the Software Library workspace, expand Application Management, and select the Applications node.
Read more >
Color - Foundations - Human Interface Guidelines - Design
Judicious use of color can enhance communication, evoke your brand, provide visual continuity, communicate status and feedback, and help people understand ...
Read more >
Software Architecture Archives - Embedded Artistry
A Software System Context Model is a type of system context model that explicitly ... We use these guidelines as the starting point...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found