美文网首页
next.js与ant创建项目

next.js与ant创建项目

作者: 多啦梦_1adc | 来源:发表于2020-06-13 16:45 被阅读0次

    mkdir next-with-antd

    cd next-with-antd

    npm init -y

    cnpm install --save react react-dom next

    mkdir pages

    cnpm install --save antd babel-plugin-import @babel/plugin-proposal-decorators @zeit/next-css

    创建.babelrc

    {"presets":["next/babel"],"plugins":[["@babel/plugin-proposal-decorators",{"legacy":true}],["import",{"libraryName":"antd","style":"css"}]]}

    创建next.config.js

    /* eslint-disable */constwithCss=require('@zeit/next-css');// fix: prevents error when .css files are required by nodeif(typeofrequire!=='undefined'){require.extensions['.css']=(file)=>{}}module.exports=withCss();

    编辑package.json

    "scripts":{"dev":"next","build":"next build","start":"next start"}

    npm run dev

    相关文章

      网友评论

          本文标题:next.js与ant创建项目

          本文链接:https://www.haomeiwen.com/subject/gicztktx.html