diff --git a/CHANGELOG.md b/CHANGELOG.md index 069eeb93..d10b1480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +# v2.0.1 (Thu Nov 28 2019) + +#### 🐛 Bug Fix + +- Load languages after setting global Prism. [#124](https://github.com/storybookjs/design-system/pull/124) ([@ghengeveld](https://github.com/ghengeveld)) + +#### ⚠️ Pushed to master + +- Update changelog ([@ghengeveld](https://github.com/ghengeveld)) + +#### Authors: 1 + +- Gert Hengeveld ([@ghengeveld](https://github.com/ghengeveld)) + +--- + # v2.0.0 (Thu Nov 28 2019) #### 💥 Breaking Change diff --git a/package.json b/package.json index 2d5ab929..b1e8e48a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/design-system", - "version": "2.0.0", + "version": "2.0.1", "description": "Storybook design system", "repository": { "type": "git", diff --git a/src/components/Highlight.js b/src/components/Highlight.js index 578860b5..2f1eea77 100644 --- a/src/components/Highlight.js +++ b/src/components/Highlight.js @@ -1,4 +1,4 @@ -/* eslint-disable react/no-danger */ +/* eslint-disable react/no-danger, global-require */ import React from 'react'; import ReactDOM from 'react-dom'; import styled from 'styled-components'; @@ -6,14 +6,15 @@ import Prism from 'prismjs'; import PropTypes from 'prop-types'; import { color } from './shared/styles'; -import 'prismjs/components/prism-bash'; -import 'prismjs/components/prism-javascript'; -import 'prismjs/components/prism-typescript'; -import 'prismjs/components/prism-json'; -import 'prismjs/components/prism-css'; -import 'prismjs/components/prism-yaml'; - -global.Prism = Prism; +if (typeof document !== 'undefined') { + global.Prism = Prism; + require('prismjs/components/prism-bash'); + require('prismjs/components/prism-javascript'); + require('prismjs/components/prism-typescript'); + require('prismjs/components/prism-json'); + require('prismjs/components/prism-css'); + require('prismjs/components/prism-yaml'); +} const languages = ['bash', 'javascript', 'typescript', 'json', 'css', 'yaml'];