tern icon indicating copy to clipboard operation
tern copied to clipboard

Document webpack plugin

Open JelteF opened this issue 8 years ago • 3 comments
trafficstars

I see that there is a webpack plugin, which I would like to use. But I, can't figure out how to configure it correctly. My own module root is in static/js/modules/ how do I use the files there for path resolving?

JelteF avatar Dec 12 '16 14:12 JelteF

I will add the document of webpack plugin and add support to webpack2 in my next PR.

You can add something like:

  "plugins": {
    "webpack": {
      "configPath": "./static/js/modules/webpack.config.js"
    }
  }

to your .tern-project file.

chemzqm avatar Dec 12 '16 15:12 chemzqm

Thanks for the help, but I don't have a webpack.config.js file because I'm running webpack using gulp. What should I put in the file then?

Just to be sure, my directory tree looks like this:

./gulpfile.js
<other files and directories>
./static/js/modules
./node_modules

And node_modules contains the deps, but static/js/modules contains my own js code.

And this is in my gulpfile:

{
  context: __dirname + '/static/js',
  resolve: {
    root: [
      __dirname + '/static/js/modules',
      __dirname + '/static/css',
      __dirname + '/static/templates',
    ],

    extensions: ['', '.js', '.jsx'],
  },
  // ... other config stuff that doesn't seem important
}

JelteF avatar Dec 12 '16 16:12 JelteF

@JelteF I suggest create a webpack.config.js which export webpack config, and make your gulpfile.js require webpack.config.js.

The file webpack.config.js could be long and specified to work on different environment, it would harder for maintain if it exist in other file.

chemzqm avatar Dec 12 '16 17:12 chemzqm