How to bundle a React app to a subdirectory on a server?

前端 未结 10 2164
名媛妹妹
名媛妹妹 2020-12-04 14:41

I have a React app I\'ve been developing on my localhost. I want to copy it to a server into a subdirectory called vensa.

My webpack config file looks like this..

10条回答
  •  忘掉有多难
    2020-12-04 15:34

    var sourcePath = path.resolve(__dirname, 'src', 'index.js');
    var buildPath = path.resolve(__dirname, 'vensa');
    
    module.exports = {
        entry: [sourcePath],
        output: {
            path: buildPath,
            filename: '[name]-[hash].js',
            hash: true
        }
        ...
    

提交回复
热议问题