This configuration is suitable for the create-react-app
project to build the scaffolding, can not find the webpack.config.js
need to npm run eject
release the configuration file
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
// Allows for better profiling with ReactDevTools
...(isEnvProductionProfile && {
'react-dom$': 'react-dom/profiling',
'scheduler/tracing': 'scheduler/tracing-profiling',
}),
...(modules.webpackAliases || {
}),
"@":path.resolve(__dirname,'../src')
},
import '@/style/index.css';
import App from '@/pages/App';
Compared with vue cli 3
scaffolding configuration alias
const path = require('path');
function resolve(dir) {
return path.join(__dirname, dir);
}
module.exports = {
lintOnSave: true,
chainWebpack: (config) => {
config.resolve.alias
.set('@', resolve('src'))
.set('@assets',resolve('src/assets'))
}
};