Skip to content

Commit

Permalink
fix: Exposing type
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Export module for TS require export as object so please import as object
  • Loading branch information
ReiiYuki committed Jan 24, 2022
1 parent b06e1b0 commit 4d5137d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ yarn add --dev define-after-bundle-webpack-plugin
#### In your webpack config

```js
const DefineAfterBundleWebpackPlugin = require('define-after-bundle-webpack-plugin')
const { DefineAfterBundleWebpackPlugin } = require('define-after-bundle-webpack-plugin')

module.exports = {
...
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "define-after-bundle-webpack-plugin",
"version": "0.0.0",
"main": "build/index.js",
"types": "build/index.d.ts",
"entry": "src/index.ts",
"deploy": "build",
"license": "MIT",
Expand All @@ -19,7 +20,7 @@
"@rollup/plugin-commonjs": "19.0.0",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.0.0",
"@rollup/plugin-typescript": "8.2.1",
"@rollup/plugin-typescript": "8.3.0",
"@types/node": "16.11.6",
"@types/webpack": "4",
"@types/webpack-env": "1.16.3",
Expand Down
4 changes: 3 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export default {
resolve(),
commonjs(),
typescript({
outDir: config.deploy
outDir: config.deploy,
declaration: true,
emitDeclarationOnly: true,
}),
json(),
visualizer({
Expand Down
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ConcatSource } from 'webpack-sources'

const PLUGIN_NAME = 'DefineAfterBundleWebpackPlugin'

class DefineAfterBundleWebpackPlugin {
export class DefineAfterBundleWebpackPlugin {
replaceMapper: Record<string, any>

constructor(replaceMapper: Record<string, any>) {
Expand Down Expand Up @@ -39,5 +39,3 @@ class DefineAfterBundleWebpackPlugin {
})
}
}

module.exports = DefineAfterBundleWebpackPlugin
2 changes: 1 addition & 1 deletion test/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path')
const DefineAfterBundleWebpackPlugin = require('../build')
const { DefineAfterBundleWebpackPlugin } = require('../build')

module.exports = {
entry: path.resolve(__dirname, 'index.js'),
Expand Down
13 changes: 4 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@
is-module "^1.0.0"
resolve "^1.19.0"

"@rollup/plugin-typescript@8.2.1":
version "8.2.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.2.1.tgz#f1a32d4030cc83432ce36a80a922280f0f0b5d44"
integrity sha512-Qd2E1pleDR4bwyFxqbjt4eJf+wB0UKVMLc7/BAFDGVdAXQMCsD4DUv5/7/ww47BZCYxWtJqe1Lo0KVNswBJlRw==
"@rollup/plugin-typescript@8.3.0":
version "8.3.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.3.0.tgz#bc1077fa5897b980fc27e376c4e377882c63e68b"
integrity sha512-I5FpSvLbtAdwJ+naznv+B4sjXZUcIvLLceYpITAn7wAP8W0wqc5noLdGIp9HGVntNhRWXctwPYrSSFQxtl0FPA==
dependencies:
"@rollup/pluginutils" "^3.1.0"
resolve "^1.17.0"
Expand Down Expand Up @@ -5560,11 +5560,6 @@ source-map@^0.7.3:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==

[email protected]:
version "1.0.4"
resolved "https://registry.yarnpkg.com/source-replacement/-/source-replacement-1.0.4.tgz#0ef6aa9fd5c15ac10b64a2df29ee449432324232"
integrity sha512-/QTmwxiHRMaBp5NPwtnryDVIXKHs+3SaErnaiPPoKyzr4rODKdPrPxG35Y6iaPtvae2Tq+P/nRu5natt2JgdEw==

sourcemap-codec@^1.4.4:
version "1.4.8"
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
Expand Down

0 comments on commit 4d5137d

Please sign in to comment.