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

How to watch source changes? #343

Open
zhaofeng-shu33 opened this issue Mar 2, 2020 · 5 comments
Open

How to watch source changes? #343

zhaofeng-shu33 opened this issue Mar 2, 2020 · 5 comments
Labels
DIscussion documentation Improvements or additions to documentation kind/question Category issues related to questions or problems

Comments

@zhaofeng-shu33
Copy link
Member

您的问题

Frequent changes of code need quick rebuild by webpack.
So I add watch options to webpack config but it seems not work.
I use command npm run start.

如果有的话,请附图

额外的信息

@zhaofeng-shu33 zhaofeng-shu33 added the kind/question Category issues related to questions or problems label Mar 2, 2020
@iLtc
Copy link
Member

iLtc commented Mar 2, 2020

I use docsite start, and without changing anything, it can rebuild after changes.

@zhaofeng-shu33
Copy link
Member Author

It is strange. I see some clue in webpack watch config. I check that

[feng@bcm wuhan2020.github.io]$ cat /proc/sys/fs/inotify/max_user_watches
8192

I do not know whether it is too slow or not.

@iLtc
Copy link
Member

iLtc commented Mar 2, 2020

Do you save code manually or does your IDE save code automatically for you? Sometimes if the IDE saves code too frequently, webpack will start to delay updates.

@zhaofeng-shu33
Copy link
Member Author

I save it manually using vim.

@zhaofeng-shu33
Copy link
Member Author

zhaofeng-shu33 commented Mar 8, 2020

To handle the problem of slow building in development. I create a custom webpack configuration file called wc.js in zh-cn directory. It is copied from webpack.config.js in the project root directory and I make some changes:

const entry = {};
module.exports = {
    entry: {'hackathonKanban': './src/pages/hackathonKanban/index.jsx'},
    output: {
        path: path.join(__dirname, '..', 'build'),
        filename: '[name].js',
    }
    // .... same as webpack.config.js
    }

Then run node ./node_modules/webpack/bin/webpack.js --config zh-cn/wc.js and the file hackathonKanban.js and hackathonKanban.css are generated. Then I can use static file server to see the results.

The total build is about 6.5 seconds on my linux machine.

@zhaofeng-shu33 zhaofeng-shu33 added DIscussion documentation Improvements or additions to documentation labels Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DIscussion documentation Improvements or additions to documentation kind/question Category issues related to questions or problems
Projects
None yet
Development

No branches or pull requests

2 participants