Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack.config.js with ES6 exports does not work #8

Open
ljani opened this issue May 6, 2016 · 3 comments
Open

webpack.config.js with ES6 exports does not work #8

ljani opened this issue May 6, 2016 · 3 comments

Comments

@ljani
Copy link

ljani commented May 6, 2016

Consider the example someone else posted: https://github.com/adam-beck/hapi-plz

If you apply this patch, everything breaks although ES6 exports should work with "the second way" mentioned in usage:

diff --git a/package.json b/package.json
index fb601cc..1249129
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "description": "",
   "main": "index.js",
   "scripts": {
-    "dev": "node dev-server.js",
+    "dev": "babel-node dev-server.js",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "keywords": [],
@@ -21,6 +21,7 @@
     "webpack": "^1.13.0"
   },
   "dependencies": {
+    "babel-cli": "^6.8.0",
     "hapi": "^13.3.0",
     "react": "^15.0.1",
     "react-dom": "^15.0.1"
diff --git a/webpack.config.js b/webpack.config.js
index ae00368..c5e09aa 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -3,7 +3,7 @@ const webpack = require('webpack');

 const HtmlWebpackPlugin = require('html-webpack-plugin');

-module.exports = {
+export default ({
   entry: [
     'webpack-hot-middleware/client',
     './src/index.js'
@@ -34,4 +34,4 @@ module.exports = {
       colors: true
     }
   }
-};
+});

The error is:

C:\devel\hapi-plz\node_modules\webpack-dev-middleware\middleware.js:106
                        if(err) throw err;
                                ^
 Error: invalid argument
    at pathToArray (C:\devel\hapi-plz\node_modules\memory-fs\lib\MemoryFileSystem.js:44:10)
    at MemoryFileSystem.mkdirpSync (C:\devel\hapi-plz\node_modules\memory-fs\lib\MemoryFileSystem.js:139:13)
    at MemoryFileSystem.(anonymous function) [as mkdirp] (C:\devel\hapi-plz\node_modules\memory-fs\lib\MemoryFileSystem.js:279:34)
    at Compiler.<anonymous> (C:\devel\hapi-plz\node_modules\webpack\lib\Compiler.js:229:25)
    at Compiler.applyPluginsAsync (C:\devel\hapi-plz\node_modules\tapable\lib\Tapable.js:60:69)
    at Compiler.emitAssets (C:\devel\hapi-plz\node_modules\webpack\lib\Compiler.js:226:7)
    at Watching.<anonymous> (C:\devel\hapi-plz\node_modules\webpack\lib\Compiler.js:54:18)
    at C:\devel\hapi-plz\node_modules\webpack\lib\Compiler.js:403:12
    at Compiler.next (C:\devel\hapi-plz\node_modules\tapable\lib\Tapable.js:67:11)
    at Compiler.<anonymous> (C:\devel\hapi-plz\node_modules\webpack\lib\CachePlugin.js:40:4)
    at Compiler.applyPluginsAsync (C:\devel\hapi-plz\node_modules\tapable\lib\Tapable.js:71:13)
    at Compiler.<anonymous> (C:\devel\hapi-plz\node_modules\webpack\lib\Compiler.js:400:9)
    at Compilation.<anonymous> (C:\devel\hapi-plz\node_modules\webpack\lib\Compilation.js:577:13)
    at Compilation.applyPluginsAsync (C:\devel\hapi-plz\node_modules\tapable\lib\Tapable.js:60:69)
    at Compilation.<anonymous> (C:\devel\hapi-plz\node_modules\webpack\lib\Compilation.js:572:10)
    at Compilation.applyPluginsAsync (C:\devel\hapi-plz\node_modules\tapable\lib\Tapable.js:60:69)

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\opt\\node\\node.exe" "C:\\opt\\node\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.7
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `babel-node dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script 'babel-node dev-server.js'.
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 hapi-plz package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel-node dev-server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs hapi-plz
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hapi-plz
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\devel\hapi-plz\npm-debug.log

Any ideas how to setup this with Babel? Everything works fine if I use the plugin via "the first way"

@AYapejian
Copy link

Seeing the same issue, just started checking it out I'll update if I find something worthwhile.

@FullStackForger
Copy link

Is there any update on this one?

@Kamahl19
Copy link

It seems this package is unmaintained so I decided to rewrite it in TS and fix all the issues. You can find it here https://github.com/Kamahl19/hapi-webpack-plugin-2

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

No branches or pull requests

4 participants