We are using the original Vuepress (0.x branch) and we want to use the configureWebpack method of the Vuepress config file to export some custom variables.
This code breaks the build, since Webpack doesn't allow custom properties since 2.0:
configureWebpack: (config) => {
config.env = process.env
}
Error:
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration has an unknown property 'env'.
I also looked at the Webpack docs for defining plugins however the problem is that the configureWebpack
method doesn't actually expose the webpack instance Vuepress uses - it directly attempts to mutate the webpack options (which isn't allowed) - but as the webpack instance isn't available we can't simply define a plugin the way webpack wants us to.
Does anyone know the proper way to expose, say, configurable environment variables which we can use in our Vue components using Vuepress 0.x?