Can I override Nuxt.js' default directory structure?
[issue link]Hi, I’m wondering if I could do something like moving the pages and components directory from
/
to
/src
From Nuxt.js’ source code /lib/webpack/base.config.js file, I saw these directories are defined in the webpack alias.
So in nuxt.config.js file in my project, I override these alias like:
var projectSrc = path.join(__dirname, 'src')
module.exports = {
extend(config, ctx) {
// Override
config.resolve.alias['~'] = path.join(projectSrc)
config.resolve.alias['~assets'] = path.join(projectSrc, 'assets')
config.resolve.alias['~components'] = path.join(projectSrc, 'components')
config.resolve.alias['~middleware'] = path.join(projectSrc, 'middleware')
config.resolve.alias['~pages'] = path.join(projectSrc, 'pages')
config.resolve.alias['~plugins'] = path.join(projectSrc, 'plugins')
}
}
But I got this error while trying to run npm run dev:
Couldn't find a `pages` directory. Please create one under the project root