vatson / rollup-plugin-vuetify

Vuetify autoloader πŸ€–
MIT License
20 stars 1 forks source link

Problem when working with Vue custom block #32

Closed caxerx closed 4 years ago

caxerx commented 4 years ago

Hello, I have a problem when use this plugin with i18n custom block. Seems vuetify plugin try to parse i18n custom block like a script. However, it's a json format and it parse failed.

$ rollup --config rollup.config.js

index.js β†’ dist/index.js...
[!] (plugin vuetify) Error: The structure of the exported component can not be recognized. Please open an issue with a usage example at https://github.com/vatson/rollup-plugin-vuetify/issues
src\MyButton.vue?rollup-plugin-vue=i18n.0.json
Error: The structure of the exported component can not be recognized. Please open an issue with a usage example at https://github.com/vatson/rollup-plugin-vuetify/issues
    at findExport (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup-plugin-vuetify\src\transform.js:107:9)
    at findUseTarget (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup-plugin-vuetify\src\transform.js:111:21)
    at module.exports (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup-plugin-vuetify\src\transform.js:152:33)
    at extractAndTransform (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup-plugin-vuetify\src\plugin.js:11:10)
    at Object.transform (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup-plugin-vuetify\src\plugin.js:32:16)
    at ModuleLoader.addModuleSource (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup\dist\shared\rollup.js:17777:30)
    at ModuleLoader.fetchModule (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup\dist\shared\rollup.js:17831:9)
    at async Promise.all (index 3)
    at ModuleLoader.fetchStaticDependencies (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup\dist\shared\rollup.js:17855:34)
    at async Promise.all (index 0)
    at ModuleLoader.fetchModule (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup\dist\shared\rollup.js:17832:9)
    at async Promise.all (index 0)
    at ModuleLoader.fetchStaticDependencies (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup\dist\shared\rollup.js:17855:34)
    at async Promise.all (index 0)
    at ModuleLoader.fetchModule (C:\Users\caxerx\Desktop\atg-vue-component-configured\packages\default-button\node_modules\rollup\dist\shared\rollup.js:17832:9)
    at async Promise.all (index 0)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
vatson commented 4 years ago

Hello @caxerx,

Could you provide an example of such component with custom block?

caxerx commented 4 years ago

The custom block is like this

<i18n lang="json">
{
  "en": {
    "hello": "hello world!"
  },
  "ja": {
    "hello": "γ“γ‚“γ«γ‘γ―γ€δΈ–η•ŒοΌ"
  }
}
</i18n>

I also configure the rollup-plugin-vue like this and use with @intlify/rollup-plugin-vue-i18n

vue({
  customBlocks: ['i18n']
})
caxerx commented 4 years ago

There are similar problem when I use extract css config.

When I configure rollup-plugin-vue like this:

vue({ css: false })

rollup-plugin-vuetify will try to parse the css block and cause an error.

vatson commented 4 years ago

@caxerx I found the cause of the error. It will be fixed in next patch release (0.2.3). Thanks for your contribution.