diff --git a/plugin/save-metadata/index.js b/plugin/save-metadata/index.js index 7cfaf38e..719eea07 100644 --- a/plugin/save-metadata/index.js +++ b/plugin/save-metadata/index.js @@ -9,7 +9,7 @@ const hostUtils = require('../../utils/host-utils'); module.exports = function SaveMetadata() { function getFallbackName(name) { - return util.format('SKY_PAGES_READY_%s', name.toUpperCase()); + return util.format('SKY_PAGES_READY_%s', name.toUpperCase().replace(/\./g, '_')); } this.plugin('emit', (compilation, done) => { diff --git a/test/config-webpack-build-aot.spec.js b/test/config-webpack-build-aot.spec.js index d0e8d0dc..67aa0139 100644 --- a/test/config-webpack-build-aot.spec.js +++ b/test/config-webpack-build-aot.spec.js @@ -150,7 +150,7 @@ describe('config webpack build-aot', () => { expect(json[2].name).toEqual('test2.js'); }); - it('should add the SKY_PAGES_READY_X variable to each entry', () => { + it('should add the SKY_PAGES_READY_X variable to each entry, replacing periods', () => { const lib = require('../config/webpack/build-aot.webpack.config'); const config = lib.getWebpackConfig({ runtime: runtimeUtils.getDefaultRuntime(), @@ -166,7 +166,7 @@ describe('config webpack build-aot', () => { switch (evt) { case 'emit': let assets = { - 'test.js': { + 'a.b.c.js': { source: () => '// My Source' } }; @@ -176,15 +176,15 @@ describe('config webpack build-aot', () => { getStats: () => ({ toJson: () => ({ chunks: [ - { id: 1, entry: true, names: ['test'], files: ['test.js'] } + { id: 1, entry: true, names: ['a.b.c'], files: ['a.b.c.js'] } ] }) }) }, () => {}); - const source = assets['test.js'].source(); + const source = assets['a.b.c.js'].source(); expect(source).toContain('// My Source'); - expect(source).toContain('var SKY_PAGES_READY_TEST = true;'); + expect(source).toContain('var SKY_PAGES_READY_A_B_C = true;'); break; } }