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

building the whole application doesn't work? #2950

Closed
mjakubicek opened this issue Mar 24, 2022 · 6 comments
Closed

building the whole application doesn't work? #2950

mjakubicek opened this issue Mar 24, 2022 · 6 comments

Comments

@mjakubicek
Copy link

How is the building of the whole application under https://riot.js.org/compiler/#compilation-via-riotjs-cli supposed to work?
If I compile the sample code from the documentation, the line
import {component} from 'riot'
is kept in the output bundle, so it doesn't work in the browser. The compilation emits
'riot' is imported by app.js, but could not be resolved – treating it as an external dependency

Apparently riot uses rollup internally for the bundling, but adding into app.js
import nodeResolve from '@rollup/plugin-node-resolve'
doesn't help either.

Any hints please?

@Kal-Aster
Copy link

I think you should refer to the rollup documentation...
The node resolve plugin has to be added to the plugins section in the rollup configuration file.

@mjakubicek
Copy link
Author

Well, using rollup directly (via rollup -c) works (after including the @rollup/plugin-node-resolve), but the way described in riot documentation (riot app.js -o dist/app.js) doesn't work. Not to mention the documentation being silent about rollup.

@GianlucaGuarini
Copy link
Member

@mjakubicek thank you for your feedback. The Riot CLI is meant to quickly compile your tags in case you want to include them as bundle in your application (using webpack, rollup...). Probably what you are looking for is more an application boilerplate setup and in that case I would you recommend to use npm init riot starting from one of our official templates.

@mjakubicek
Copy link
Author

I see -- but this portion of the documentation is then wrong:

image

It simply does not work, not even with a single tag. It doesn't produce a bundle one could directly use in the browser, but it says so.

@GianlucaGuarini
Copy link
Member

@mjakubicek you are absolutely right, thank you. The doc should be updated!
In your case however a <script> in your html file

<script src='https://unpkg.com/riot@6.1.2/riot.js'></script>

should solve the problem.

@GianlucaGuarini
Copy link
Member

@riotjs/cli@6.1.0 includes the rollup plugins to bundle the external dependencies. There is no need to update the documentation anymore. Thank you for your feedback @mjakubicek

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

No branches or pull requests

3 participants