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

Plugin order causes issues #177

Closed
zcuric opened this issue Mar 14, 2019 · 4 comments
Closed

Plugin order causes issues #177

zcuric opened this issue Mar 14, 2019 · 4 comments

Comments

@zcuric
Copy link

zcuric commented Mar 14, 2019

Hi,
when trying to fix the build for vue-plyr (redxtech/vue-plyr#60) by updating to bili@4 (see here: https://github.com/zcuric/vue-plyr/pull/1) I encountered an issue when using specific babel config with vue files (I was trying to solve this actually: rollup/rollup-plugin-babel#260).

Error I got was this:

error Failed to bundle src/index.js in cjs format

Stack Trace:
SyntaxError: /Users/zdravko/Code/vue-plyr/src/VuePlyr.vue: Unexpected token (1:0)

> 1 | <template>
    | ^
  2 |   <div>
  3 |     <slot/>
  4 |   </div>
    at Parser.raise (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:3831:17)
    at Parser.unexpected (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:5143:16)
    at Parser.parseExprAtom (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:6283:20)
    at Parser.parseExprSubscripts (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:5862:23)
    at Parser.parseMaybeUnary (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:5842:21)
    at Parser.parseExprOps (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:5729:23)
    at Parser.parseMaybeConditional (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:5702:23)
    at Parser.parseMaybeAssign (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:5647:21)
    at Parser.parseExpression (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:5595:23)
    at Parser.parseStatementContent (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:7378:23)
    at Parser.parseStatement (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:7243:17)
    at Parser.parseBlockOrModuleBlockBody (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:7810:25)
    at Parser.parseBlockBody (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:7797:10)
    at Parser.parseTopLevel (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:7181:10)
    at Parser.parse (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:8660:17)
    at parse (/Users/zdravko/Code/vue-plyr/node_modules/@babel/parser/lib/index.js:10660:38)

After debugging, we concluded that was probably because of order of plugins, which we test by moving

bili/src/index.ts

Lines 290 to 301 in 28b1a19

if (config.plugins.vue !== false && (source.hasVue || config.plugins.vue)) {
plugins.push(
this.localRequire('rollup-plugin-vue')(
Object.assign(
{
css: false
},
config.plugins.vue
)
)
)
}

to here:

In bili@3 this wasn't an issue, probably because of the way the plugins were defined, array was used in that config.

So, there should be a way to define the plugin priority or order of execution to fix these kind of errors.

cc @vladimyr

@egoist
Copy link
Owner

egoist commented Mar 15, 2019

It should be fixed in 4.5.2

@zcuric
Copy link
Author

zcuric commented Mar 15, 2019

It should be fixed in 4.5.2

Thank you!
👏

@hosein2398
Copy link
Contributor

So isn't this done?!
Why not to close?

@javier-garcia-meteologica

I encountered problems using @rollup/plugin-eslint.

// bili.config.ts
import { Config } from 'bili';

const config: Config = {
  input: 'src/index.ts',
  output: {
    format: ['cjs', 'esm']
  },
  plugins: {
    '@rollup/plugin-eslint': {
      throwOnError: true
    }
  }
};

export default config;

The problem is that bili puts this plugin in last place, so it's linting transformed code and not the original one.

   1:51  error    'rollupPluginBabelHelpers.js' imported multiple times

@zcuric zcuric closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2024
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

4 participants