Skip to content

Commit acc0807

Browse files
Merge pull request #2 from almond-bongbong/feature/refactor-config
♻️ Improve build configuration and clean up code
2 parents 2277265 + bbc35b2 commit acc0807

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

rollup.config.mjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
import babel from '@rollup/plugin-babel';
12
import commonjs from '@rollup/plugin-commonjs';
3+
import eslint from '@rollup/plugin-eslint';
24
import { nodeResolve } from '@rollup/plugin-node-resolve';
3-
import typescript from 'rollup-plugin-typescript2';
45
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
56
import postcss from 'rollup-plugin-postcss';
6-
import babel from '@rollup/plugin-babel';
7-
import eslint from '@rollup/plugin-eslint';
7+
import typescript from 'rollup-plugin-typescript2';
8+
9+
import fs from 'node:fs';
10+
import { dirname, join } from 'node:path';
11+
import { fileURLToPath } from 'node:url';
812

9-
import packageJson from './package.json' assert { type: 'json' };
13+
const configPath = join(
14+
dirname(fileURLToPath(import.meta.url)),
15+
'./package.json',
16+
);
17+
const packageJson = JSON.parse(fs.readFileSync(configPath, 'utf8'));
1018

1119
const extensions = ['js', 'jsx', 'ts', 'tsx', 'mjs'];
1220

src/index.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
'use client';
2-
3-
import React, {
4-
ReactElement,
5-
ReactNode,
6-
useCallback,
7-
useEffect,
8-
useRef,
9-
} from 'react';
1+
import React, { ReactElement, useCallback, useEffect, useRef } from 'react';
102
import styles from './index.module.scss';
113
import { randomNumBetween } from './libs/utils';
124
import Particle from './model/Particle';

0 commit comments

Comments
 (0)