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

Not compatible with webpack2 #349

Open
ibio opened this issue Feb 2, 2017 · 9 comments
Open

Not compatible with webpack2 #349

ibio opened this issue Feb 2, 2017 · 9 comments

Comments

@ibio
Copy link

ibio commented Feb 2, 2017

When I upgraded to webpack2/npm(4.1.2), it raised the following runtime error:
Uncaught TypeError: this.configure is not a function at Object.exports.Router (webpack:///./~/director/lib/director/router.js?:181) at init (webpack:///./app/view/router.jsx?:58) at eval (webpack:///./app/view/router.jsx?:121) at Object.212 (app.js:2) at n (vendor.js:1) at eval (webpack:///./app/main.js?:5) at Object.529 (app.js:9) at n (vendor.js:1) at window.webpackJsonp (vendor.js:1) at app.js:1

I figured it out that webpack2 somehow did not recognize the ./build path, instead it used ./lib path, which is declared in package.json("main": "./lib/director"). I believe there are some issues because what's in the ./lib is not complete code and we can only use the code in ./build path.

However, I am wondering why it worked fined with webpack1. Plese let me know what happened here. thanks :)

@pscottdevos
Copy link

Can confirm. Having the same problem when upgrading to webpack 2.2.1

@statianzo
Copy link

Webpack 1 used the browserify main field in package.json. That behavior was removed in Webpack 2. If you want to keep that behavior, add it back to your webpack config in resolve.mainFields. Otherwise, add a resolve.alias for director.

@creage
Copy link

creage commented Mar 14, 2017

import { Router } from 'director/build/director';
...
...
...
const router = new Router().init();

this worked for me on Webpack2

@jeremyk
Copy link

jeremyk commented May 4, 2017

This works. But when I try to server render I get a document is not defined error. Seems like this didn't happen when importing the other way.

@javidan
Copy link

javidan commented Jun 13, 2017

Same Issue for me. When using

import { Router } from 'director';

Getting error init is not a function

if use

import { Router } from 'director/build/director';

Server side rendering is not working. Getting error document is not defined

@statianzo
Copy link

@javidan did you test my suggestion?

@clearfram3
Copy link

@javidan do you know the reason importing from 'director/build/director' works?

@statianzo
Copy link

@ClearedFram3 see my comment above. Webpack 1 used to read the browserify package.json setting that specified director/build/director. Webpack 2 dropped that behavior.

@qman19791123
Copy link

Correct import introduction

import {Router} from 'director/build/director.js'

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

8 participants