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

Strings are inlined into entry modules instead of _base.js #12

Closed
camwest opened this issue Nov 18, 2016 · 1 comment
Closed

Strings are inlined into entry modules instead of _base.js #12

camwest opened this issue Nov 18, 2016 · 1 comment

Comments

@camwest
Copy link

camwest commented Nov 18, 2016

Hey there,

I have an issue with how CSS exported from modules is inlined. This might be an issue for closure compiler instead of splittable but I wanted to get your take on it first. See below for details:

# a.js
import css from './css-module';

const style = document.createElement('style');
style.textContent = css;
document.body.appendChild(style);
# b.js
import css from './css-module';
const style = document.createElement('style');
style.textContent = css;
document.body.appendChild(style);
# css-module.js

const css = `
...huge amount of css
`;

export default css;

Expected behaviour:

  • The string exported from css-module should be extracted into the _base.js and shared between the a.js and b.js entry point modules

Actual behaviour:

  • The string is inlined into a.js and b.js duplicating the contents across both modules.
@cramforce
Copy link
Owner

Very interesting problem! Like really! But please file in closure compiler
repo. It isn't entirely clear what is the right thing to do. Often keeping
base smaller is better even if delivering more bytes in total.

On Nov 17, 2016 6:04 PM, "Cameron Westland" notifications@github.com
wrote:

Hey there,

I have an issue with how CSS exported from modules is inlined. This might
be an issue for closure compiler instead of splittable but I wanted to get
your take on it first. See below for details:

a.jsimport css from './css-module';

const style = document.createElement('style');style.textContent = css;document.body.appendChild(style);

b.js

import css from './css-module';
const style = document.createElement('style');
style.textContent = css;
document.body.appendChild(style);

css-module.js

const css = ...huge amount of css;

export default css;

Expected behaviour:

  • The string exported from css-module should be extracted into the
    _base.js and shared between the a.js and b.js entry point modules

Actual behaviour:

  • The string is inlined into a.js and b.js duplicating the contents
    across both modules.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#12, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAFeT5sfUFtpRoszzwuJKGPsHi0V_7kcks5q_QeTgaJpZM4K2Cgt
.

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

2 participants