https://cypress.io logo
WebPack Preprocess vue-loader config help
# i-need-help
s
I would like to import constants from the .vue components but get an error from WebPack
Module parse failed: Unexpected token (1:0)
I've npm installed
vue-loader
and
vue-loader-plugin
and added this to the cypress.config.ts:
Copy code
import preprocessor from '@cypress/webpack-preprocessor'

e2e: {
    setupNodeEvents(on, config) {

      const options = webpackPreprocessor.defaultOptions
      options.webpackOptions.module.rules[0].use[0].options.presets.push('vue-loader')

      on('file:preprocessor', webpackPreprocessor(options))
}
But get the error:
Module parse failed: Unexpected token (21:12)
I get no errors if I'm not trying to import consts or have any webpack config in the cypress.config.ts. Read this as 'adding to the default options' - https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor#modifying-default-options We want to be able to handle .vue files and everything else continue as normal. Any ideas?
3 Views