schovi / webpack-chrome-extension

Moved and redesigned into https://github.com/schovi/create-chrome-extension
MIT License
167 stars 27 forks source link

too many redirects #17

Open kutomer opened 8 years ago

kutomer commented 8 years ago

Hello, When I execute "gulp" I get the following errors: ERROR in ./~/ws/lib/WebSocketServer.js Module not found: Error: Cannot resolve module 'tls' in /home/.../webpack-chrome-extension/node_modules/ws/lib

ERROR in ./~/options/lib/options.js Module not found: Error: Cannot resolve module 'fs' in /home/.../webpack-chrome-extension/node_modules/options/lib

But then it says: webpack: bundle is now VALID.

And then when I open the background page I get: Failed to load resource: net::ERR_TOO_MANY_REDIRECTS *At first I got Insecure connection error but I found an answer for it in the issues.

I'm using Ubuntu 14.04 and Chrome 47

b.t.w when I execute "gulp -p" I'm getting some errors but the extension is working.

Thanks!

kutomer commented 8 years ago

I found a solution to the problem, but I'm not 100% sure that it's the best one. dev-env/webpack.generator.js : 42 node: { __dirname: true, fs: "empty", net: "empty", tls: "empty" }

Do you guys want me to open a pull requests?

Thanks again :)

schovi commented 8 years ago

@kutomer: Is it related to your project or generally to this repository? I dont have any of these errors. In one project, where we use joi package, we solve similliar problem with following:

// webpack config
{
    ...,
    externals: {
      net: '1',
      dns: '1'
    },
    ...
}

It overrides requiring of these libraries with 1. I am not sure which solution is better and more "system" correct.

Try if this problem occurs on fresh checkouted repository and then we can solve it there.

kutomer commented 8 years ago

The error reproduce on a fresh checked out repository, so there is nothing to do with my code.

I guess that it is an environment issue but I'm really not sure about that.

schovi commented 8 years ago

Maybe some new versions of npm packages, or npm v3. I migrate to it recently and dont have time to test all projects with that. I know it should not affect it, but who knows.

kutomer commented 8 years ago

maybe so, I will try to update some of the packages and check it out.

kutomer commented 8 years ago

Well, I upgraded all the outdated dependencies: babel 5.6.23 --> 6.3.26 babel-core 5.8.3 --> 6.4.0 babel-loader 5.3.2 --> 6.2.1 css-loader 0.15.5 --> 0.23.1 fs-extra 0.24.0 --> 0.26.4 gulp-bg 0.0.5 --> 0.0.8 gulp-eslint 0.15.0 --> 1.1.1 react 0.13.3 --> 0.14.6 style-loader 0.12.3 --> 0.13.0 webpack 1.10.1 --> 1.12.10 webpack-dev-server 1.10.1 --> 1.14.1

Things got even worse, I get new Error when running "gulp": [23:45:20] Requiring external module babel-core/register /home/.../gulpfile.babel.js:2 import fs from 'fs'; ^^^^^^

SyntaxError: Unexpected token import at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at loader (/home/.../node_modules/babel-register/lib/node.js:130:5) at Object.require.extensions.(anonymous function) as .js at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Liftoff.handleArguments (/usr/lib/node_modules/gulp/bin/gulp.js:116:3) at Liftoff. (/usr/lib/node_modules/gulp/node_modules/liftoff/index.js:192:16)

_I tried to undo all my upgrades and upgraded only the dependencies shown in _bold* and got the same error.

schovi commented 8 years ago

This last problem is with update babel to version 6. There is whole new configuration for babel and it need much more work to be done than just update it. I will take look sometime at it. Babel 6 is now stable, support all transformers and is faster and better configurable.