How can I serve NPM packages using Flask?

后端 未结 3 1310
执笔经年
执笔经年 2020-12-24 12:40

I have a small Flask app which currently sources jQuery and highlight.js from external servers. I\'d like to make these local dependencies which I pull in via NPM.

W

3条回答
  •  情书的邮戳
    2020-12-24 13:31

    Go to your static folder and there initialize your npm project.

    cd flask_app/static
    $ npm init
    

    after installing and saving npm packages you can serve them like this:

    
    

    credits to: https://codeburst.io/creating-a-full-stack-web-application-with-python-npm-webpack-and-react-8925800503d9

提交回复
热议问题