Skip to content

Commit

Permalink
🐛 Fix to resolve internal module on bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed May 10, 2021
1 parent 617a3c4 commit c9decd6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"dev": "vitepress dev docs",
"lint": "eslint . --ext .ts --ignore-pattern dist",
"prepare:build": "esno scripts/pre-build.ts",
"post:build": "esno scripts/post-build.ts",
"build": "yarn prepare:build && rollup -c rollup.config.ts && yarn post:build",
"build": "yarn prepare:build && rollup -c rollup.config.ts",
"build:docs": "vitepress build docs",
"serve": "vitepress serve docs",
"test": "deno test test/",
Expand Down Expand Up @@ -56,6 +55,7 @@
"prettier": "^2.2.1",
"readdirp": "^3.6.0",
"rollup": "^2.45.1",
"rollup-plugin-dts": "^3.0.1",
"rollup-plugin-terser": "^7.0.2",
"semantic-release": "^17.4.2",
"semantic-release-gitmoji": "^1.3.4",
Expand Down
46 changes: 37 additions & 9 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,54 @@
import { nodeResolve } from '@rollup/plugin-node-resolve'
import ts from '@wessberg/rollup-plugin-ts'
import dts from 'rollup-plugin-dts'
import { terser } from 'rollup-plugin-terser'

import { main, module } from './package.json'

const config = {
input: 'temp/mod.ts',
plugins: [ts(), nodeResolve(), terser()],
const config = [
{
input: 'temp/mod.ts',
plugins: [
ts({
tsconfig: (resolvedConfig) => ({
...resolvedConfig,
declaration: false
})
}),
,
nodeResolve(),
terser()
],

output: [
{
output: {
file: main,
format: 'umd',
sourcemap: true,
name: 'F'
},
{
}
},
{
input: 'temp/mod.ts',
plugins: [ts(), nodeResolve(), terser()],

output: {
file: module,
format: 'es',
sourcemap: true
}
]
}
},
{
input: 'dist/index.es.d.ts',
output: { dir: 'dist', entryFileNames: 'index.es.d.ts' },
plugins: [
dts({
respectExternal: true,
compilerOptions: {
declarationMap: true
}
})
]
}
]

export default config
7 changes: 0 additions & 7 deletions scripts/post-build.ts

This file was deleted.

9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6293,6 +6293,15 @@ rimraf@^3.0.0, rimraf@^3.0.2:
dependencies:
glob "^7.1.3"

rollup-plugin-dts@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-3.0.1.tgz#4419efb51d935cc0cff6f577f8aad97a980ee524"
integrity sha512-sdTsd0tEIV1b5Bio1k4Ei3N4/7jbwcVRdlYotGYdJOKR59JH7DzqKTSCbfaKPzuAcKTp7k317z2BzYJ3bkhDTw==
dependencies:
magic-string "^0.25.7"
optionalDependencies:
"@babel/code-frame" "^7.12.13"

rollup-plugin-terser@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d"
Expand Down

0 comments on commit c9decd6

Please sign in to comment.