prepack-webpack-plugin
prepack-webpack-plugin copied to clipboard
throw new InitializationError()
After added to webpack and run, I have error:
....
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({}),
/*....*/
]
I also meet this error.
The error originates from within Prepack, i.e. it is nothing to do with prepack-webpack-plugin
. I haven't had time to have a look whether there is a way to pull additional information about the error. As it is, it is not very useful and barely says that Prepack cannot work with your codebase.
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 ]
I get this error as well if I use this plugin before uglify plugin, could be related to https://github.com/gajus/prepack-webpack-plugin/issues/14
When I to disable uglify plugin, I have next error message
91% additional asset processingThis operation is not yet supported on abstract value
__IntrospectionError
at bundle.js:34992:71
at call (native)
at __webpack_require__ (bundle.js:30:12)
at bundle.js:4602:17
at call (native)
at __webpack_require__ (bundle.js:30:12)
at bundle.js:102990:22
at call (native)
at __webpack_require__ (bundle.js:30:12)
at bundle.js:104231:1
at call (native)
at __webpack_require__ (bundle.js:30:12)
at bundle.js:99906:1
at call (native)
at call (native)
at __webpack_require__ (bundle.js:30:12)
at bundle.js:136930:1
at call (native)
at __webpack_require__ (bundle.js:30:12)
at bundle.js:76:18
at bundle.js:11:17
at webpackUniversalModuleDefinition (bundle.js:7:11)
at bundle.js:1:1
~/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 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 Compilation.applyPluginsAsyncSeries (~/project/node_modules/tapable/lib/Tapable.js:142:13)
at Compilation.seal (~/project/node_modules/webpack/lib/Compilation.js:579:8)
at ~/project/node_modules/webpack/lib/Compiler.js:493:16
at ~/project/node_modules/tapable/lib/Tapable.js:225:11
at _addModuleChain (~/project/node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (~/project/node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
System info:
System Version: macOS 10.12.4 (16E195)
Kernel Version: Darwin 16.5.0
node v7.9.0
npm v4.2.0
+1 I'm facing the same issue.
I opened discus on main page of plugin: https://github.com/facebook/prepack/issues/590
I just want to check if people think this is the cause of my error:
##Error
new PrepackWebpackPlugin({})
^
TypeError: PrepackWebpackPlugin is not a constructor
at Object.<anonymous> (/Users/pagem/Documents/workspace/transplant/webpack.config.js:29:9)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at requireConfig (/usr/local/lib/node_modules/webpack/bin/convert-argv.js:96:18)
at /usr/local/lib/node_modules/webpack/bin/convert-argv.js:109:17
##Code
const path = require('path');
const webpack = require('webpack');
const PrepackWebpackPlugin = require('prepack-webpack-plugin');
module.exports = {
entry: {
app: [
path.resolve(path.join(__dirname, "public", "js", 'app.jsx'))
],
},
watch: true,
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
},
{test: /\.css$/, loader: "style-loader!css-loader"},
]
},
output: {
path: path.join(__dirname, "public", "js"),
filename: '[name].js'
},
plugins: [
new PrepackWebpackPlugin({})
],
};
@wookoouk your error seems related to improper require statement.
If you do: const PrepackWebpackPlugin = require('prepack-webpack-plugin').default;
instead of just require('prepack-webpack-plugin')
, it should work.
See the second part of example #here.
@btiwaree I made this change and it gave me the error described above.
##Code
const path = require('path');
const webpack = require('webpack');
const PrepackWebpackPlugin = require('prepack-webpack-plugin').default;
module.exports = {
entry: {
app: [
path.resolve(path.join(__dirname, "public", "js", 'app.jsx'))
],
},
watch: true,
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
},
{test: /\.css$/, loader: "style-loader!css-loader"},
]
},
output: {
path: path.join(__dirname, "public", "js"),
filename: '[name].js'
},
plugins: [
new PrepackWebpackPlugin({})
],
};
##Error
/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run build --scripts-prepend-node-path
> [email protected] build /Users/pagem/Documents/workspace/transplant
> webpack
Webpack is watching the files…
(node:2962) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
This operation is not yet supported on abstract value
__IntrospectionError
at app.js:4935:56
at call (native)
at call (native)
at __webpack_require__ (app.js:20:12)
at app.js:32396:29
at call (native)
at call (native)
at __webpack_require__ (app.js:20:12)
at app.js:23925:18
at call (native)
at __webpack_require__ (app.js:20:12)
at app.js:26870:17
at call (native)
at __webpack_require__ (app.js:20:12)
at app.js:45634:18
at call (native)
at __webpack_require__ (app.js:20:12)
at app.js:66:18
at app.js:1:10
/Users/pagem/Documents/workspace/transplant/node_modules/prepack/lib/prepack-standalone.js:60
throw new InitializationError();
^
Error: An error occurred while prepacking. See the error logs.
at new InitializationError (/Users/pagem/Documents/workspace/transplant/node_modules/prepack/lib/prepack-standalone.js:44:14)
at prepack (/Users/pagem/Documents/workspace/transplant/node_modules/prepack/lib/prepack-standalone.js:60:11)
at Compilation.compilation.plugin (/Users/pagem/Documents/workspace/transplant/node_modules/prepack-webpack-plugin/dist/PrepackPlugin.js:58:56)
at Compilation.applyPluginsAsyncSeries (/Users/pagem/Documents/workspace/transplant/node_modules/tapable/lib/Tapable.js:142:13)
at self.applyPluginsAsync.err (/Users/pagem/Documents/workspace/transplant/node_modules/webpack/lib/Compilation.js:635:10)
at Compilation.applyPluginsAsyncSeries (/Users/pagem/Documents/workspace/transplant/node_modules/tapable/lib/Tapable.js:131:46)
at sealPart2 (/Users/pagem/Documents/workspace/transplant/node_modules/webpack/lib/Compilation.js:631:9)
at Compilation.applyPluginsAsyncSeries (/Users/pagem/Documents/workspace/transplant/node_modules/tapable/lib/Tapable.js:131:46)
at Compilation.seal (/Users/pagem/Documents/workspace/transplant/node_modules/webpack/lib/Compilation.js:579:8)
at /Users/pagem/Documents/workspace/transplant/node_modules/webpack/lib/Compiler.js:493:16
at /Users/pagem/Documents/workspace/transplant/node_modules/tapable/lib/Tapable.js:225:11
at _addModuleChain (/Users/pagem/Documents/workspace/transplant/node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (/Users/pagem/Documents/workspace/transplant/node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/Cellar/node/7.10.0/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "run" "build" "--scripts-prepend-node-path"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script 'webpack'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the transplant package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs transplant
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls transplant
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/pagem/.npm/_logs/2017-05-10T21_01_07_438Z-debug.log
Process finished with exit code 1
@iHaiduk how do u deal with the problem?
404s will fallback to /index.html invalid RegExp SyntaxError at eval:39:18 at eval:2:3 at call (native) at call (native) at __webpack_require__ (unknown) at fn (vendor.js:115:20) at eval:24:16 at call (native) at __webpack_require__ (unknown) at fn (vendor.js:115:20) at eval:1:66 at call (native) at eval:1:29 at call (native) at __webpack_require__ (unknown) at fn (vendor.js:115:20) at eval:1:1 at call (native) at __webpack_require__ (unknown) at vendor.js:1:10 /Users/wangtao/bamaying/scorpio/client/admin/node_modules/prepack/lib/prepack-standalone.js:60 throw new InitializationError(); ^
This operation is not yet supported on abstract values Date.now() and Date.now()
__IntrospectionError
at getFullYear (native)