Skip to content
This repository was archived by the owner on Apr 14, 2020. It is now read-only.

declaration-bundler-webpack-plugin Unhandled rejection TypeError: Cannot read property 'split' of undefined #2

Closed
rupeshtiwari opened this issue Oct 5, 2018 · 2 comments · Fixed by #3

Comments

@rupeshtiwari
Copy link

Hi I saw there is an closed ticket here and here in this repository related to this issue. Which is not yet resolved though people gave their own plugin code which are working solution and solves the issue. However, I see the official plugin version "declaration-bundler-webpack-plugin": "^1.0.3", is still not working it is keep failing for the same error. I guess the fix is not yet merged ? Hence I am opening new issue.

Expected Behaviour

create bundle.d.ts

Actual Behaviour

throwing error Unhandled rejection TypeError: Cannot read property 'split' of undefined


> [email protected] build Z:\rupesh\rnd\webpack-library-ps\lib-pj
> webpack

(node:12164) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
Unhandled rejection TypeError: Cannot read property 'split' of undefined
    at DeclarationBundlerPlugin.generateCombinedDeclaration (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\declaration-bundler-webpack-plugin\plugin.js:44:30)
    at Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\declaration-bundler-webpack-plugin\plugin.js:25:45
    at AsyncSeriesHook.eval [as callAsync] (eval at create (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\HookCodeFactory.js:32:10),
<anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\Hook.js:154:20)
    at Compiler.emitAssets (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\webpack\lib\Compiler.js:358:19)
    at onCompiled (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\webpack\lib\Compiler.js:225:9)
    at hooks.afterCompile.callAsync.err (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\webpack\lib\Compiler.js:547:14)
    at _err0 (eval at create (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:11:1)
    at Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\ts-loader\dist\after-compile.js:28:9
    at AsyncSeriesHook.eval [as callAsync] (eval at create (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\HookCodeFactory.js:32:10),
<anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\Hook.js:154:20)
    at compilation.seal.err (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\webpack\lib\Compiler.js:544:30)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\HookCodeFactory.js:32:10),
<anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\Hook.js:154:20)
    at hooks.optimizeAssets.callAsync.err (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\webpack\lib\Compilation.js:1296:35)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\HookCodeFactory.js:32:10),
<anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\Hook.js:154:20)
    at hooks.optimizeChunkAssets.callAsync.err (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\webpack\lib\Compilation.js:1287:32)
    at _err0 (eval at create (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:11:1)
    at Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\uglifyjs-webpack-plugin\dist\index.js:287:11
    at step (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\uglifyjs-webpack-plugin\dist\uglify\Runner.js:94:11)
    at Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\uglifyjs-webpack-plugin\dist\uglify\Runner.js:117:20
    at tryCatcher (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:694:18)
    at Promise._fulfill (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:638:18)
    at Promise._resolveCallback (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:432:57)
    at Promise._settlePromiseFromHandler (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:524:17)
    at Promise._settlePromise (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:694:18)
    at Promise._fulfill (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:638:18)
    at Promise._resolveCallback (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:432:57)
    at Promise._settlePromiseFromHandler (Z:\rupesh\rnd\webpack-library-ps\lib-pj\node_modules\bluebird\js\release\promise.js:524:17)

Steps to Reproduce the Problem

Download code from this github project

# go to lib-pj and run below scripts #
npm i 
npm run build

Location of a Minimal Repository that Demonstrates the Issue.

github project

@marco-quintella
Copy link
Contributor

I made a PR that fixes this issue. Already test and it's working perfectly.

The issue was related to the access to the lines of the .d.ts files that have been changed to the source() function since on the webpack hooks implementation.

@smol smol closed this as completed in #3 Jul 1, 2019
@robbyemmert
Copy link

Can you please publish this update on NPM?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants