Skip to content

Commit

Permalink
build(bezier-icons): change to using the node resolve plugin to resol…
Browse files Browse the repository at this point in the history
…ve ts modules
  • Loading branch information
sungik-choi committed Jun 19, 2023
1 parent 1931a7c commit e98fc1a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/bezier-icons/package.json
Expand Up @@ -43,13 +43,14 @@
"author": "Channel Corp.",
"license": "Apache-2.0",
"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.1",
"@rollup/plugin-virtual": "^3.0.1",
"@rollup/pluginutils": "^5.0.2",
"@svgr/core": "^8.0.0",
Expand Down
9 changes: 6 additions & 3 deletions packages/bezier-icons/rollup.config.mjs
@@ -1,17 +1,20 @@
import * as fs from 'fs'
import * as path from 'path'

import { DEFAULT_EXTENSIONS } from '@babel/core'
import alias from '@rollup/plugin-alias'
import { babel } from '@rollup/plugin-babel'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'
import virtual from '@rollup/plugin-virtual'
import { createFilter } from '@rollup/pluginutils'
import { transform } from '@svgr/core'
import { defineConfig } from 'rollup'
import { visualizer } from 'rollup-plugin-visualizer'
import { optimize } from 'svgo'

const extensions = [...DEFAULT_EXTENSIONS, '.ts', '.tsx', '.svg']

const config = {
input: {
icons: 'icons',
Expand Down Expand Up @@ -269,7 +272,7 @@ export default defineConfig({
external: ['react'],
plugins: [
virtual({ 'src/index.ts': entryModuleContent }),
typescript(),
nodeResolve({ extensions }),
svgBuild({ include: `${iconBasePath}/*.svg` }),
/**
* Module resolution is not working well inside the virtual module, so use the alias plugin to resolve the module manually.
Expand All @@ -282,7 +285,7 @@ export default defineConfig({
}),
babel({
exclude: 'node_modules/**',
extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],
extensions,
envName: 'production',
babelHelpers: 'bundled',
}),
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock
Expand Up @@ -3503,13 +3503,14 @@ __metadata:
version: 0.0.0-use.local
resolution: "@channel.io/bezier-icons@workspace:packages/bezier-icons"
dependencies:
"@babel/core": ^7.22.5
"@babel/preset-env": ^7.22.5
"@babel/preset-react": ^7.22.5
"@babel/preset-typescript": ^7.22.5
"@rollup/plugin-alias": ^5.0.0
"@rollup/plugin-babel": ^6.0.3
"@rollup/plugin-node-resolve": ^15.1.0
"@rollup/plugin-terser": ^0.4.3
"@rollup/plugin-typescript": ^11.1.1
"@rollup/plugin-virtual": ^3.0.1
"@rollup/pluginutils": ^5.0.2
"@svgr/core": ^8.0.0
Expand Down

0 comments on commit e98fc1a

Please sign in to comment.