1
0
Fork 0
freesewing/sites/lab/next.config.mjs

72 lines
2.1 KiB
JavaScript
Raw Normal View History

2022-06-17 12:02:09 +02:00
import path from 'path'
import i18nConfig from './next-i18next.config.js'
import { designs } from './prebuild/designs.mjs'
import { plugins } from './prebuild/plugins.mjs'
2022-06-19 15:10:35 +02:00
import { banner } from '../../scripts/banner.mjs'
2022-06-17 12:02:09 +02:00
2022-06-17 14:12:46 +02:00
let greeting = false
2022-06-17 12:02:09 +02:00
const config = {
experimental: {
externalDir: true,
},
i18n: i18nConfig.i18n,
pageExtensions: ['js', 'mjs'],
webpack: (config) => {
2022-08-29 08:29:55 +02:00
// JSON support
//config.module.rules.push({
// test: /\.json$/,
// type: 'json',
// use: 'json-loader'
//})
2022-08-29 08:29:55 +02:00
2022-06-17 12:02:09 +02:00
// YAML support
config.module.rules.push({
test: /\.ya?ml$/,
type: 'json',
use: 'yaml-loader',
2022-06-17 12:02:09 +02:00
})
// Suppress warnings about importing version from package.json
// We'll deal with it in v3 of FreeSewing
config.ignoreWarnings = [/only default export is available soon/]
2022-06-17 12:02:09 +02:00
// Aliases
config.resolve.alias.shared = path.resolve('../shared/')
config.resolve.alias.site = path.resolve('.')
config.resolve.alias.prebuild = path.resolve('./prebuild')
2022-06-17 12:02:09 +02:00
config.resolve.alias.config = path.resolve('../../config/')
config.resolve.alias.designs = path.resolve('../../designs/')
config.resolve.alias.plugins = path.resolve('../../plugins/')
config.resolve.alias.pkgs = path.resolve('../../packages/')
// Load designs from source, rather than compiled package
for (const design of designs) {
config.resolve.alias[`@freesewing/${design}$`] = path.resolve(
`../../designs/${design}/src/index.mjs`
)
2022-06-17 12:02:09 +02:00
}
// Load plugins from source, rather than compiled package
for (const plugin of plugins) {
config.resolve.alias[`@freesewing/${plugin}$`] = path.resolve(
`../../plugins/${plugin}/src/index.mjs`
)
2022-06-17 12:02:09 +02:00
}
// Load these from source, rather than compiled package
for (const pkg of ['core', 'i18n', 'models', 'snapseries']) {
config.resolve.alias[`@freesewing/${pkg}$`] = path.resolve(
`../../packages/${pkg}/src/index.mjs`
)
2022-06-17 12:02:09 +02:00
}
2022-06-17 14:12:46 +02:00
if (!greeting) {
greeting = true
2022-06-19 15:10:35 +02:00
console.log(banner)
}
2022-06-17 14:12:46 +02:00
2022-06-17 12:02:09 +02:00
return config
},
2022-06-17 12:02:09 +02:00
}
2022-06-17 12:02:09 +02:00
export default config