/* eslint-disable no-param-reassign */
module.exports = {
  publicPath: process.env.VUE_APP_ROUTE_PREFIX,
  lintOnSave: false,
  runtimeCompiler: true,
  transpileDependencies: [
    '@shipnity/template',
    'vue-toast-notification',
    'vuex-persist'
  ],
  css: {
    loaderOptions: {
      sass: {
        additionalData: "@import '~@/assets/scss/variables.scss'"
      },
      scss: {
        implementation: require('sass')
      }
    }
  },
  chainWebpack: (config) => {
    const svgRule = config.module.rule('svg')
    svgRule.uses.clear()
    svgRule
      .use('vue-svg-loader')
        .loader('vue-svg-loader')

    config.module
      .rule('i18n')
      .resourceQuery(/blockType=i18n/)
      .type('javascript/auto')
      .use('i18n')
        .loader('@kazupon/vue-i18n-loader')
      .end()

    config.module
      .rule('raw')
      .test(/\.txt$/)
      .use('raw-loader')
      .loader('raw-loader')
      .end()
  },
  pluginOptions: {
    apollo: {
      enableMocks: false,
      enableEngine: true
    }
  }
}
