Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

throw new InitializationError() #590

Closed
iHaiduk opened this issue May 6, 2017 · 8 comments
Closed

throw new InitializationError() #590

iHaiduk opened this issue May 6, 2017 · 8 comments
Labels

Comments

@iHaiduk
Copy link

iHaiduk commented May 6, 2017

Hello! I added prepack-webpack-plugin plugin for my project how use your package. After I have error message with compilation.
Author of plugin are claims what this problem from you side.
Original issues: gajus/prepack-webpack-plugin#17

Details:

....
91% additional asset processingnot an object                                            

TypeError

~/project/node_modules/prepack/lib/prepack-standalone.js:59
throw new InitializationError();
^

Error: An error occurred while prepacking. See the error logs.
    at new InitializationError (~/project/node_modules/prepack/lib/prepack-standalone.js:35:14)
at prepack (~/project/node_modules/prepack/lib/prepack-standalone.js:59:11)
at Compilation.compilation.plugin (~/project/node_modules/prepack-webpack-plugin/dist/PrepackPlugin.js:58:56)
at Compilation.applyPluginsAsyncSeries (~/project/node_modules/tapable/lib/Tapable.js:142:13)
at self.applyPluginsAsync.err (~/project/node_modules/webpack/lib/Compilation.js:635:10)
at next (~/project/node_modules/tapable/lib/Tapable.js:138:11)
at Compilation.compilation.plugin.callback (~/project/node_modules/webpack/lib/ProgressPlugin.js:113:6)
at next (~/project/node_modules/tapable/lib/Tapable.js:140:14)
at ExtractTextPlugin.<anonymous> (~/project/node_modules/extract-text-webpack-plugin/index.js:341:4)
at next (~/project/node_modules/tapable/lib/Tapable.js:140:14)
at ExtractTextPlugin.<anonymous> (~/project/node_modules/extract-text-webpack-plugin/index.js:341:4)
at next (~/project/node_modules/tapable/lib/Tapable.js:140:14)
at ExtractTextPlugin.<anonymous> (~/project/node_modules/extract-text-webpack-plugin/index.js:341:4)
at Compilation.applyPluginsAsyncSeries (~/project/node_modules/tapable/lib/Tapable.js:142:13)
at sealPart2 (~/project/node_modules/webpack/lib/Compilation.js:631:9)
at next (~/project/node_modules/tapable/lib/Tapable.js:138:11)
at Compilation.compilation.plugin (~/project/node_modules/webpack/lib/ProgressPlugin.js:109:6)
at next (~/project/node_modules/tapable/lib/Tapable.js:140:14)
at ExtractTextPlugin.<anonymous> (~/project/node_modules/extract-text-webpack-plugin/index.js:313:5)
at ~/project/node_modules/async/dist/async.js:356:16
at iteratorCallback (~/project/node_modules/async/dist/async.js:936:13)
at ~/project/node_modules/async/dist/async.js:840:16
at ~/project/node_modules/extract-text-webpack-plugin/index.js:297:6
at ~/project/node_modules/async/dist/async.js:356:16
at iteratorCallback (~/project/node_modules/async/dist/async.js:936:13)
at ~/project/node_modules/async/dist/async.js:840:16
at ~/project/node_modules/extract-text-webpack-plugin/index.js:294:13
at ~/project/node_modules/async/dist/async.js:3025:16
at eachOfArrayLike (~/project/node_modules/async/dist/async.js:941:9)
at eachOf (~/project/node_modules/async/dist/async.js:991:5)
at Object.eachLimit (~/project/node_modules/async/dist/async.js:3089:3)

Packege.json :

{
  "name": "project",
  "version": "0.0.1",
  "devDependencies": {
   /*....*/
    "prepack-webpack-plugin": "^1.1.0",
    "webpack": "^2.5.0",
    "webpack-dev-server": "^2.4.5"
  },
  "dependencies": {
   /*...*/
  }
}

webpack config:

entry: { /*...*/},
module: {
        rules: [
          {
                test: /\.js$/,
                exclude: /node_modules/,
                use: [
                    'react-hot-loader',
                    'jsx-loader',
                    {
                        loader: 'babel-loader',
                        query: {
                            presets: ['react', 'es2015', 'stage-0'],
                            plugins: ['transform-regenerator', 'transform-async-functions', 'transform-react-display-name', 'transform-decorators-legacy', 'transform-react-jsx-img-import'],
                            cacheDirectory: false
                        }
                    }
                ]
            },
          /*....*/
       ]
},
 plugins: [
        new PrepackWebpackPlugin({}),
        /*....*/
]

log from npm

0 info it worked if it ends with ok
    1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 silly lifecycle [email protected]~prebuild: no script for prebuild, continuing
    7 info lifecycle [email protected]~build: [email protected]
8 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:~/project/node_modules/.bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:~/project/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle [email protected]~build: CWD: ~/project
11 silly lifecycle [email protected]~build: Args: [ '-c',
    11 silly lifecycle   'node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --progress --color -p --bail  --config ./webpack.production.config.js' ]
12 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
13 info lifecycle [email protected]~build: Failed to exec build script
14 verbose stack Error: [email protected] build: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --progress --color -p --bail  --config ./webpack.production.config.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:194:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:194:7)
14 verbose stack     at maybeClose (internal/child_process.js:899:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd ~/project
17 error Darwin 16.5.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
19 error node v7.9.0
20 error npm  v4.2.0
21 error code ELIFECYCLE
22 error errno 1
23 error [email protected] build: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --progress --color -p --bail  --config ./webpack.production.config.js`
23 error Exit status 1
24 error Failed at the [email protected] build script 'node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --progress --color -p --bail  --config ./webpack.production.config.js'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the isomorphic package,
    24 error not with npm itself.
24 error Tell the author that this fails on your system:
    24 error     node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --progress --color -p --bail  --config ./webpack.production.config.js
24 error You can get information on how to open an issue for this project with:
24 error     npm bugs isomorphic
24 error Or if that isn't available, you can get their info via:
24 error     npm owner ls isomorphic
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]
@NTillmann
Copy link
Contributor

This seems to be the issue:

91% additional asset processingThis operation is not yet supported on abstract value
__IntrospectionError
at bundle.js:34992:71

You could either look at bundle.js:34992:71 and try to understand what's going on there. In a nutshell, the code is doing something that's not currently supported by Prepack along the global code. Could be a loop over some values that cannot be determined at build time, or could be something else.

Prepack is not yet ready for use in production, and one of the remaining issues is having better error message...

@iHaiduk
Copy link
Author

iHaiduk commented May 8, 2017

When the prepack plug-in is turned off, the build shows the following code(34992:71) :

/* 697 */
/***/ (function(module, exports, __webpack_require__) {

// 26.1.6 Reflect.get(target, propertyKey [, receiver])
var gOPD           = __webpack_require__(48)
  , getPrototypeOf = __webpack_require__(49)
  , has            = __webpack_require__(39)
  , $export        = __webpack_require__(3)
  , isObject       = __webpack_require__(21)
  , anObject       = __webpack_require__(12);

function get(target, propertyKey/*, receiver*/){
  var receiver = arguments.length < 3 ? target : arguments[2]
    , desc, proto;
  if(anObject(target) === receiver)return target[propertyKey];
  if(desc = gOPD.f(target, propertyKey))return has(desc, 'value')
    ? desc.value
    : desc.get !== undefined
      ? desc.get.call(receiver)
      : undefined;
  if(isObject(proto = getPrototypeOf(target)))return get(proto, propertyKey, receiver);
}

$export($export.S, 'Reflect', {get: get});

/***/ }),

After I decided to try to start the prepack of an already compiled but not minifined project:
$ prepack bundle.js --out bundle-prepack.js
And I have next:

webpackJsonp is not defined
ReferenceError
at bundle.js:11:8
at webpackUniversalModuleDefinition (bundle.js:7:11)
at bundle.js:1:1

Source:

P.S. I know what prepack is young but will be cool if it will can work with webpack

@NTillmann
Copy link
Contributor

Also see here: #544.

@iHaiduk
Copy link
Author

iHaiduk commented May 8, 2017

This really fixes the bug with webpackJsonp is not defined, but this test was performed for the unpacked version.

As for further work, I received such an answer:
$ prepack bundle.js --out bundle-prepack.js --trace

[calls] >partial evaluation
[calls] <partial evaluation
[calls] >partial evaluation
[calls] <partial evaluation
[calls] >__abstract("function")
[calls] <__abstract
[calls] >partial evaluation
[calls] <partial evaluation
[calls] >partial evaluation
[calls] <partial evaluation
[calls] >__assumeDataProperty((some object), "webpackJsonp", (some abstract value))
[calls] <__assumeDataProperty
[calls] >partial evaluation
[calls] <partial evaluation
[calls] >partial evaluation
[calls] <partial evaluation
[calls] >TypeError("not an object")
[calls] <TypeError
[calls] >partial evaluation
[calls]   >partial evaluation
[calls]   <partial evaluation
[calls]   >partial evaluation
[calls]   <partial evaluation
[calls]   >[Symbol.hasInstance]((some object))
[calls]   <[Symbol.hasInstance]
[calls] <partial evaluation
[calls] >partial evaluation
[calls] <partial evaluation
[calls] >partial evaluation
[calls] <partial evaluation
not an object
TypeError

@mehmetkose
Copy link

another same InitializationError issue within Gulpjs

@SalomonSmeke
Copy link

SalomonSmeke commented May 27, 2017

edited reason: irrelevant, red herring.

@NTillmann
Copy link
Contributor

Do you have steps for us to reproduce the issue?

@NTillmann
Copy link
Contributor

Closing, as we couldn't make progress on the diagnosis. Feel free to re-open with new information.

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

No branches or pull requests

4 participants