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

docs(playground): fix webpack config #1391

Merged
merged 1 commit into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"lint:fix": "yarn lint --fix",
"lint:fix:it": "NODE_ENV=production eslint --quiet --fix --ext .tsx,.ts,.js",
"prettier:check": "prettier --check \"**/*.{json,html,css,scss}\"",
"playground": "cd playground && webpack serve",
"playground": "cd playground && RNG_SEED='elastic-charts' webpack serve",
"pq": "pretty-quick",
"semantic-release": "semantic-release --debug",
"start": "yarn storybook",
Expand Down
6 changes: 2 additions & 4 deletions playground/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import React from 'react';

import { Example } from '../storybook/stories/goal/22_horizontal_plusminus.story';

export class Playground extends React.Component {
render() {
return <Example />;
}
export function Playground() {
return <Example />;
}
19 changes: 18 additions & 1 deletion playground/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
* Side Public License, v 1.
*/

const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');

module.exports = {
entry: './index.tsx',
mode: 'development',
output: {
filename: 'bundle.js',
path: __dirname,
},
module: {
rules: [
Expand Down Expand Up @@ -55,7 +59,20 @@ module.exports = {
},
],
},
plugins: [
new HtmlWebpackPlugin({
hash: true,
template: './index.html',
filename: 'index.html',
favicon: '../public/favicon.ico',
}),
new webpack.EnvironmentPlugin({ RNG_SEED: null }),
],
resolve: {
alias: {
'@elastic/charts$': path.resolve(__dirname, '../packages/charts/src'),
'@elastic/charts/': path.resolve(__dirname, '../packages/charts/'),
},
extensions: ['.tsx', '.ts', '.js'],
},
};