-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Using parcel but not pointing it at entry point #1225
Labels
Comments
Same. |
Yes this works
## mypackage.js:
```
var Test = function(){
}
exports.Test = Test;
```
## package.json
```
"scripts": {
"build": "parcel build src/mypackage.js --global MYPACKAGE --out-file
mypackage"
},
"devDependencies": {
"parcel-bundler": "git+https://github.com/parcel-bundler/parcel.git"
}
```
## demo/index.html
```
<script src="../dist/mypackage.js"></script>
<script>
var test = new MYPACKAGE.Test();
</script>
```
…On 2 May 2018 at 18:05, Jasper De Moor ***@***.***> wrote:
Doesn't this PR fix this issue? #453
<#453>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1225 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AByOtbDYBOGjaROE7feTNy_tmHWdd8EVks5tuedtgaJpZM4TdvLg>
.
|
The last post is correct, that's exactly what |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello team,
What is the recommended approach for using parcel, but not pointing it at the outermost resource? For example, let's say I have a JavaScript module that exports a class
Foo
atfoo.js
.index.html
should be able to include the output generated byparcel foo.js
and then create an instance ofFoo
in inline JavaScript inindex.html
rather than any externalbootstrap.js
, etc.The reason for this is that I would like to use parcel with an ASP.NET Core project, which has its own templating (cshtml). I need to output view-specific parameters to be passed in for the correct instantiation of
Foo
object.I tried this:
and directed
parcel
atfoo.ts
as the entrypoint, which generated afoo.js
that pulled in all the imports used byFoo
, but unfortunately it does not seem to actually generate an export forFoo
itself, as this inindex.html
does not work:I guess what I'm asking is how I can get parcel to package the entrypoint itself in a format that would be usable from plain JavaScript, without doing something like this in a file
bootstrap.js
:Just to expose module
Foo
for use in index.html:I see in the parcel-generated JavaScript this line:
Is there any way to get to this export?
The text was updated successfully, but these errors were encountered: