A
A
Alexander Mischuk2016-01-27 20:26:22
Node.js
Alexander Mischuk, 2016-01-27 20:26:22

Who can help me deal with webpack?

Hi, I’ll say right away that I’m doing the first webpack project. I read the docs, tutorials and articles, but there are a couple of problems.
They gave me a finished project with its own structure, and it is extremely difficult for me to figure out what's what.
j2 project without html / stylus.
Modules are now building from 3 to 6 seconds, which is extremely slow, and I just can’t deal with webpack-dev-server with livereload.
Now it started working in a rather strange mode, as for me.
I run two command lines with a watcher and a server.
1) webpack --progress --colors --watch
2) node app.js Markup
changes - node app.js needs to be restarted.
I can’t set up page autoload, and a lot of time is wasted reloading with minimal movements. It is especially strange that the project is large and now only 2 pages, and modules are assembled on average about 4 seconds. It is difficult to imagine what will happen when the number of templates exceeds 20-30.
If anyone can help me figure it out, I'd be very grateful.
app.js content

var express = require('express'),
    nunjucks = require('nunjucks'),
    RXS = require('./tags_common'),
    app = express(),
    path = require('path');

console.log(__dirname);
app.use('/static', express.static(path.join(__dirname, '/../static')));

var env = nunjucks.configure('../templates', {
    autoescape: true,
    express: app
});

env.addExtension('tag_rxs', new RXS.tag_rxs());
env.addExtension('tag_vts', new RXS.tag_vts());

app.get('/', function (req, res) {
    res.render('apps/frontend/index_view.j2');
});
app.get('/recipe_profile.j2', function (req, res) {
    res.render('apps/frontend/recipe_profile.j2');
});

var server = app.listen(3000, function () {
    var host = server.address().address;
    var port = server.address().port;

    console.log('Example app listening at http://%s:%s', host, port);
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question