Skip to content

Commit

Permalink
fix: Ensure preview mode loads static assets correctly (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltaranto committed Sep 2, 2021
1 parent 76e585b commit 9ad4af4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions cypress/integration/smoke.js
@@ -1,11 +1,16 @@
import { getFirstFrame, loadPlayroom } from '../support/utils';

describe('Smoke', () => {
beforeEach(() => {
it('frames are interactive', () => {
loadPlayroom();
getFirstFrame().click('center');
});

it('frames are interactive', () => {
getFirstFrame().click('center');
it('preview mode loads correctly', () => {
cy.visit(
'http://localhost:9000/preview#?code=N4Igxg9gJgpiBcIA8AxCEB8r1YEIEMAnAei2LUyXJxAF8g'
)
.get('body')
.then((el) => expect(el.get(0).innerText).to.eq('Foo\nFoo\nBar'));
});
});
1 change: 1 addition & 0 deletions lib/makeWebpackConfig.js
Expand Up @@ -166,6 +166,7 @@ module.exports = async (playroomConfig, options) => {
chunksSortMode: 'none',
chunks: ['preview'],
filename: 'preview/index.html',
base: playroomConfig.baseUrl || '/',
}),
...(options.production
? []
Expand Down
2 changes: 1 addition & 1 deletion utils/index.js
Expand Up @@ -35,7 +35,7 @@ const createPreviewUrl = ({ baseUrl, code, theme, paramType = 'hash' }) => {
if (code || theme) {
const compressedData = compressParams({ code, theme });

path = `/preview${paramType === 'hash' ? '#' : ''}?code=${compressedData}`;
path = `/preview/${paramType === 'hash' ? '#' : ''}?code=${compressedData}`;
}

if (baseUrl) {
Expand Down

0 comments on commit 9ad4af4

Please sign in to comment.