gulp - Using Webpack for hot-loader and generating a physical file w/ ReactJs ES6 -


i have reactjs es6 (ie 'import' keywords) app uses gulp generating physical build file , webpack hot-loading changes virtual file. wanted combine 2 services npm start (which current loads webpack, not gulp).

server.js file

 var webpack = require('webpack');  var webpackdevserver = require('webpack-dev-server');  var config = require('./webpack.config');   new webpackdevserver(webpack(config), {    publicpath: config.output.publicpath,    hot: true,    historyapifallback: true  }).listen(3000, 'localhost', function (err, result) {    if (err) {      console.log(err);    }     console.log('listening @ localhost:3000');  }); 

webpack.config.js file

 var path = require('path');  var webpack = require('webpack');   module.exports = {    devtool: 'eval',    entry: [      'webpack-dev-server/client?http://localhost:3000',      'webpack/hot/only-dev-server',      './src/index.js'    ],    output: {        filename: 'bundle.js',        path: path.join(__dirname, 'build'),        publicpath: '/static/'    },     plugins: [      new webpack.hotmodulereplacementplugin(),      new webpack.noerrorsplugin()    ],    resolve: {      extensions: ['', '.js', '.jsx']    },    module: {      loaders: [{        test: /\.jsx?$/,        loaders: ['react-hot', 'babel-loader'],        include: path.join(__dirname, 'src'),        exclude: /node_modules/      },        { test: /\.css$/, loader: 'style-loader!css-loader' }      ]    }  }; 

i thought based on webpack's output section, webpack generate physical file in build folder while creating virtual file in '/static/bundle.js'

currently, virtual file hot-loader working, no physical file has been built in 'build' path.

am correct webpack can replace gulp , generate both physical & virtual build file? if so, code in err far creating physical build file?

thanks in advance.

solution:

my code fine, needed add scripts in package.json:

 ..... "scripts": { "test": "echo \"error: no test specified\" && exit 1", "build": "webpack", "gulp": "gulp", "all":  "npm run build && npm run gulp"  ..... 

i run "npm run all" , can run webpack , gulp 1 command


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -