Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'preval can also handle some simple dynamic values as well' not working on webpack #99

Open
ilyary opened this issue Dec 1, 2021 · 0 comments

Comments

@ilyary
Copy link

ilyary commented Dec 1, 2021

Using:
"webpack": "^4.46.0",
"nuxt": "^2.15.8",
"babel-plugin-preval": "^5.0.0",

const locale = 'ru'

// @/langs/ru.js:
// // @preval
//
// module.exports = require('../tools/i18n').packs.ru
const langPack = require(`@/langs/${locale}.js`) // WORKS
//const langPack = preval`module.exports = require('../tools/i18n').packs.ru` // WORKS
//const langPack = preval`module.exports = require('../tools/i18n').packs.${locale}` // DOES NOT WORK

Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: ${project}/plugins/index.js: Unable to determine the value of your preval string
at PluginPass.TaggedTemplateExpression (${project}/node_modules/babel-plugin-preval/dist/index.js:72:17)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant