Skip to content

Add file with variables at build time? #8978

Answered by ssuess
ssuess asked this question in CLI - PWA mode
Discussion options

You must be logged in to vote

Ok I figured this out. First install this package:

npm i create-file-webpack --save-dev

Then inside quasar.conf.js add this line at the top:

const CreateFileWebpack = require('create-file-webpack')

Then after extendWebpack (cfg) { add something like

extendWebpack (cfg) {
        cfg.plugins.push(new CreateFileWebpack({
          path: 'builds/prod',
          // file name
          fileName: 'version.txt',
          // content of the file
          content: '{ "version": "' + Date.now() + '" }'
        })),

Works great!

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jitendra1607
Comment options

Answer selected by ssuess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants