arackaf / customize-cra

Override webpack configurations for create-react-app 2.0
MIT License
2.78k stars 268 forks source link

怎么配置publicPath #193

Open heny opened 4 years ago

onlyling commented 4 years ago

edit package.json to override homepage.

{
    "homepage": "http://mywebsite.com/relativepath"
}
{
    "homepage": "./"
}

create react app code

create react app doc

heny commented 4 years ago

edit package.json to override homepage.

{
    "homepage": "http://mywebsite.com/relativepath"
}
{
    "homepage": "./"
}

create react app code

create react app doc

After testing, contains HTTP cannot add , can add pathname

clydee-geng commented 4 years ago

修改config-overrides.js

const {override,setWebpackPublicPath} = require('customize-cra')

module.exports = override(
  setWebpackPublicPath('yourPublicPath')
)