bradstewart / electron-boilerplate-vue

Boilerplate application for Electron runtime
724 stars 94 forks source link

same module i use in app/ and build/ where package.json i put ? #23

Closed xiaokaike closed 8 years ago

xiaokaike commented 8 years ago

i use express in build script dev-server.js and use express in app/ electron app

then i put the express in the outside package.json like

devDependencies:{
"express": "^4.13.3",
...

and i also put the express in app/package.json

dependencies:{
"express": "^4.13.3",
...

when i run npm run start then i get a warning

WARNING in ./app/~/express/lib/view.js
            Critical dependencies:
            78:29-56 the request of a dependency is an expression
             @ ./app/~/express/lib/view.js 78:29-56

How can I solve this warning

bradstewart commented 8 years ago

@xiaokaike I think this has something to do with webpack rather than the having express in both packages. Try adding express as an external to prevent webpack from compiling it (which is what we want since it will ship with the app):

// build/webpack.base.conf.js 
...
plugins: [
    new webpack.ExternalsPlugin('commonjs2', [
      ...
      'screen',
      'shell',
      'express' // <-- Add this line.
    ])
  ],
...
xiaokaike commented 8 years ago

@bradstewart thanks close the issue