Files
vue-cli/packages/@vue/cli-ui/index.js
Maël Nison 0a5c79be52 Enforces require.resolve for loaders (#4532)
* Enforces require.resolve for loaders

* Updates the lockfile

* Fixes more things

* Adds an extra check

* test(loaders): fix the tests

* style(cli): fix the linting

* style(cli): fix the linting (on windows)

* Update package.json

* Updates the lockfile

* chore: sync dependency versions

* chore: sync dependency versions

* chore: don't introduce unnecessary changes in yarn.lock

* extraneous space
2019-11-04 16:26:33 +08:00

37 lines
854 B
JavaScript

exports.clientAddonConfig = function ({ id, port = 8042 }) {
return {
publicPath: process.env.NODE_ENV === 'production'
? `/_addon/${id}`
: `http://localhost:${port}/`,
configureWebpack: {
output: {
// Important
filename: 'index.js'
}
},
css: {
extract: false
},
chainWebpack: config => {
config.plugins.delete('preload')
config.plugins.delete('prefetch')
config.plugins.delete('html')
config.plugins.delete('optimize-css')
config.optimization.splitChunks(false)
config.module
.rule('gql')
.test(/\.(gql|graphql)$/)
.use('gql-loader')
.loader(require.resolve('graphql-tag/loader'))
.end()
},
devServer: {
headers: {
'Access-Control-Allow-Origin': '*'
},
port
}
}
}