Git Product home page Git Product logo

Comments (12)

matthewp avatar matthewp commented on August 23, 2024 1

Couple of things:

  1. I'm seeing a bug in the cache extension where it puts the version number on twice for some reason.
  2. This would have to be a new option, something like renderingCacheVersion so it only applies to what gets rendered SSR. This would be something that only the CSS plugin knows about (for now).

from steal.

MarcGodard avatar MarcGodard commented on August 23, 2024

Can someone respond? I notice that this cache key feature is still not working as expected.

from steal.

matthewp avatar matthewp commented on August 23, 2024

My guess is that the server-side version is not running the cache extension for some reason. Do you see the one with the cache key first or the one without?

from steal.

MarcGodard avatar MarcGodard commented on August 23, 2024

@matthewp I see the one without first.

Could it be something with my service (added here)?

const ssr = require('done-ssr-middleware')
const path = require('path')

module.exports = ssr({
  config: path.join(__dirname, '/package.json!npm'),
  main: 'site-template/index.stache!done-autorender',
  envs: {
    'server-production': {
      renderingBaseURL: '/dist',
      baseURL: 'public',
      bundlesPath: 'dist/bundles'
    },
    'server-development': {
      baseURL: 'client'
    }
  }
}, {
  strategy: 'seo',
  xhrCache: false,
  timeout: 30000
})

from steal.

matthewp avatar matthewp commented on August 23, 2024

I think you need to add cacheVersion to your server-production config. That's how it knows to append the version number.

if(loader.isEnv("production") && loader.cacheVersion) {

from steal.

MarcGodard avatar MarcGodard commented on August 23, 2024

@matthewp when I do that I get this error in the console:

error: ENOENT: no such file or directory, open 'public/dist/bundles/site-template/index.js?v=10&v=10' {"errno":-2,"code":500,"syscall":"open","path":"public/dist/bundles/site-template/index.js?v=10&v=10","statusCode":404,"url":"file:public/dist/bundles/site-template/index.js?v=10&v=10"}

The index.js file is there.

Here are the changes I made:

const ssr = require('done-ssr-middleware')
const path = require('path')

module.exports = ssr({
  config: path.join(__dirname, '/package.json!npm'),
  main: 'site-template/index.stache!done-autorender',
  envs: {
    'server-production': {
      renderingBaseURL: '/dist',
      baseURL: 'public',
      bundlesPath: 'dist/bundles',
      cacheVersion: process.env.HEROKU_RELEASE_VERSION || 10,
      cacheKey: 'v'
    },
    'server-development': {
      baseURL: 'client'
    }
  }
}, {
  strategy: 'seo',
  xhrCache: false,
  timeout: 30000
})

Also not sure why its there twice index.js?v=10&v=10

You have any thoughts?

from steal.

matthewp avatar matthewp commented on August 23, 2024

Oh yeah, I guess that makes sense, you don't want to do it that way. This might be specific to CSS and not a general issue with the cache extension.

If you can, can you edit your node_modules/done-css/css.js file here: https://github.com/donejs/css/blob/30bf1b52a5c1bb7c1a1a96eadf8ddebceccda168/css.js#L65

And manually add the version just to see if that works?

link.setAttribute("href", css.href + '?v=123');

from steal.

MarcGodard avatar MarcGodard commented on August 23, 2024

@matthewp Yes, that worked. Unfortunately, I cannot deploy it with that.

from steal.

matthewp avatar matthewp commented on August 23, 2024

I'm looking into a possible fix.

from steal.

matthewp avatar matthewp commented on August 23, 2024

I think the duplicate number is just a product of the test helpers being used in the tests. Not sure it's a real bug, so going to proceed with #2.

from steal.

matthewp avatar matthewp commented on August 23, 2024

Moving this to done-css.

from steal.

matthewp avatar matthewp commented on August 23, 2024

Moved here: donejs/css#66

from steal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.