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

passing a custom publicPath breaks serialization #65

Closed
1 of 5 tasks
thescientist13 opened this issue Apr 30, 2019 · 7 comments · Fixed by #90
Closed
1 of 5 tasks

passing a custom publicPath breaks serialization #65

thescientist13 opened this issue Apr 30, 2019 · 7 comments · Fixed by #90
Assignees
Labels
bug Something isn't working v0.3.0
Milestone

Comments

@thescientist13
Copy link
Member

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

Passing a config with a custom publicPath doesn't result in a serialized HTML file

config

// (**note**: `devServer is required see: )
module.exports = {
  publicPath: '/owen',
  devServer: {
    port: 1981,
    host: 'localhost'
  }
};

index.html

<!-- cat public/index.html -->
<body>

    <eve-app></eve-app>

  <script type="text/javascript" src="/owen/index.861cad5fddf22530b046.bundle.js"></script>

should be something like

<body>

    <eve-app><!---->
        <lit-route path="/hello" component="eve-hello" class="style-scope eve-app"><!----><!----></lit-route>
				<lit-route path="/" component="eve-index" class="style-scope eve-app" active=""><!----><!----><eve-index class="style-scope lit-route"><!---->
      <div class="wrapper style-scope eve-index">
        <div class="eve-index content style-scope">
          <wc-md-index class="style-scope eve-index"><!---->

      <div class="style-scope wc-md-index">
        <h3 class="style-scope wc-md-index">Greenwood</h3>
<p class="style-scope wc-md-index">This is the home page built by Greenwood. Make your own pages in src/pages/index.js!</p>

      </div>
      <!----></wc-md-index>
        </div>
      </div>
    <!----></eve-index><!----><!----></lit-route>

        <lit-route class="style-scope eve-app"><!----><!----></lit-route>
    <!----></eve-app>

Details

Serialization has regressed, likely when #53 was merged.

@thescientist13 thescientist13 added the bug Something isn't working label Apr 30, 2019
@hutchgrant
Copy link
Member

hutchgrant commented Apr 30, 2019

I don't think it ever supported custom publicPaths other than the default '/'. Though consideration was made for it within our 404 and index templates. But now that it's consolidated and available under the config, this feature is needed.

@thescientist13
Copy link
Member Author

@thescientist13 thescientist13 self-assigned this May 1, 2019
@thescientist13
Copy link
Member Author

thescientist13 commented May 1, 2019

will look at as I / after working on #66 , which now makes the case easy to reproduce. Just compare having a custom greenwood.config.js

// bueno
module.exports = {};

// no bueno
module.exports = {
  publicPath: '/owen'
}

and running

$ yarn build
$ cat ./public/index.html

and compare the output

@thescientist13
Copy link
Member Author

thescientist13 commented May 1, 2019

This seems to be the offending publicPath, in webpack.config.common.js
https://github.com/ProjectEvergreen/greenwood/blob/master/packages/cli/config/webpack.config.common.js#L42

output: {
  path: context.publicDir,
  filename: '[name].[hash].bundle.js',
  publicPath: '/' // config.publicPath
},

will serialize even when publicPath is set in greenwood.config.js

It seem the webpack output is the same in .greenwood/, so seems to be isolated to just the serialize part of the pipeline.

@thescientist13
Copy link
Member Author

thescientist13 commented May 1, 2019

Ok, seems to be related to the interplay between setting output.path and output.publicPath, think I might have a handle on it

@hutchgrant
Copy link
Member

Did this get resolved yet? I don't see a PR for this issue.

@thescientist13
Copy link
Member Author

thescientist13 commented May 10, 2019

Still open. Was hoping getting #74 in first would help with debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v0.3.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants