Skip to content

Commit 8c31767

Browse files
Fix: Added SSR support, Revised README with CodeSandbox link (#14)
1 parent c1768cc commit 8c31767

File tree

4 files changed

+33
-34
lines changed

4 files changed

+33
-34
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</div>
88

99
A fully customizable, ready to use scatter graph UI package for React.
10-
Try tweaking React Scatter Graph using this codesandbox link <a href="https://codesandbox.io/s/stupefied-currying-ornk52" >here</a>
10+
Try tweaking React Scatter Graph using this codesandbox link <a href="https://codesandbox.io/p/sandbox/late-shadow-wzdh9l" >here</a>
1111

1212
## Installation
1313

@@ -17,6 +17,8 @@ npm install @keyvaluesystems/react-scatter-graph
1717

1818
You’ll need to install React separately since it isn't included in the package.
1919

20+
Note for **Next.js** users, if you are using Next.js version 13 or later, you will have to use the `use client` feature to ensure proper compatibility.
21+
2022
## Usage
2123

2224
React Scatter Graph can run in a very basic mode like this:

package-lock.json

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"react-scripts": "5.0.1",
7070
"sass": "^1.58.3",
7171
"sass-loader": "^13.2.0",
72-
"style-loader": "^3.3.1",
72+
"style-loader": "^3.3.3",
7373
"terser-webpack-plugin": "^5.3.5",
7474
"ts-jest": "^29.0.5",
7575
"ts-loader": "^9.4.2",

webpack.config.js

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,46 @@ const path = require('path');
22
const webpack = require('webpack');
33
const TerserPlugin = require('terser-webpack-plugin');
44
const getPackageJson = require('./scripts/getPackageJson');
5-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
6-
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
5+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6+
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
77
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally');
88

9-
const {
10-
version,
11-
name,
12-
license,
13-
repository,
14-
author,
15-
} = getPackageJson('version', 'name', 'license', 'repository', 'author');
9+
const { version, name, license, repository, author } = getPackageJson(
10+
'version',
11+
'name',
12+
'license',
13+
'repository',
14+
'author'
15+
);
1616

1717
const banner = `
1818
${name} v${version}
1919
${repository.url}
2020
21-
Copyright (c) ${author.replace(/ *<[^)]*> */g, " ")} and project contributors.
21+
Copyright (c) ${author.replace(/ *<[^)]*> */g, ' ')} and project contributors.
2222
2323
This source code is licensed under the ${license} license found in the
2424
LICENSE file in the root directory of this source tree.
2525
`;
2626

2727
module.exports = {
28-
mode: "production",
28+
mode: 'production',
2929
devtool: 'source-map',
3030
entry: './src/index.tsx',
3131
output: {
3232
filename: 'index.js',
3333
path: path.resolve(__dirname, 'build'),
34-
library: "ScatterGraph",
34+
library: 'ScatterGraph',
3535
libraryTarget: 'umd',
36-
clean: true
36+
clean: true,
37+
globalObject: 'this'
3738
},
3839
externals: {
39-
'react': 'react'
40+
react: 'react'
4041
},
4142
optimization: {
4243
minimize: true,
43-
minimizer: [
44-
new TerserPlugin({ extractComments: false }),
45-
new CssMinimizerPlugin()
46-
],
44+
minimizer: [new TerserPlugin({ extractComments: false }), new CssMinimizerPlugin()]
4745
},
4846
module: {
4947
rules: [
@@ -53,7 +51,7 @@ module.exports = {
5351
use: {
5452
loader: 'babel-loader',
5553
options: {
56-
presets: ['@babel/preset-env', '@babel/preset-react'],
54+
presets: ['@babel/preset-env', '@babel/preset-react']
5755
}
5856
}
5957
},
@@ -73,18 +71,16 @@ module.exports = {
7371
},
7472
plugins: [
7573
new MiniCssExtractPlugin({
76-
filename: 'css/index.css'
74+
filename: 'css/index.css'
7775
}),
7876
new webpack.BannerPlugin(banner),
7977
new MergeIntoSingleFilePlugin({
8078
files: {
81-
'types/index.d.ts': [
82-
path.resolve(__dirname, 'src/types/types.d.ts')
83-
]
79+
'types/index.d.ts': [path.resolve(__dirname, 'src/types/types.d.ts')]
8480
}
8581
})
8682
],
8783
resolve: {
88-
extensions: ['.ts', '.js', '.tsx', '.json', ".css", ".scss"]
84+
extensions: ['.ts', '.js', '.tsx', '.json', '.css', '.scss']
8985
}
90-
};
86+
};

0 commit comments

Comments
 (0)