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

Unable to add public path the final build #208

Closed
msrshahrukh100 opened this issue Nov 23, 2022 · 10 comments
Closed

Unable to add public path the final build #208

msrshahrukh100 opened this issue Nov 23, 2022 · 10 comments

Comments

@msrshahrukh100
Copy link

Describe the bug
I am trying to add a publicPath to the webpack config file but the URL is not included in the final build. I want to store my build on S3 and then fetch it on my website. Pardon me if I am making a mistake here. I wanted the final build to include the URLs of my S3 bucket.

To Reproduce
Steps to reproduce the behavior:

  1. Edit the file webpack.designer.js to include the following in the output section
output: {
        filename: "./[name].js",
        path: path.resolve(__dirname, "./dist/designer"),
        publicPath: "https://test.s3.ap-south-1.amazonaws.com/"
    },

Expected behavior
The public path URL is included in the final build. For eg. in the output file paperbits.js the file URL for grid-snippets.json is /data/grid-snippets.json but I wanted it to be https://test.s3.ap-south-1.amazonaws.com/data/grid-snippets.json

Desktop (please complete the following information):

  • OS: iOS
  • Browser chrome 107.0.5304.110
@azaslonov
Copy link
Member

Hi @msrshahrukh100, I'm not familiar with this specific feature of webpack, but maybe I could help differently: if you need just to load snippets from a remote URL, we could expose a setting for you in design.config.json. Would that work?

@msrshahrukh100
Copy link
Author

Yes absolutely, it's exactly what I am looking for. I just need to fetch my js files from a remote URL so I need all the URLs in the final build to contain an S3 URL and not a relative URL.
Exposing a setting for this will be great. WIll it take time for this change to be implemented?

@azaslonov
Copy link
Member

It's public holidays here in US, we can add this setting some time next week. I'll update this thread once it's merged.

@msrshahrukh100
Copy link
Author

Hi @azaslonov please let me know if there's an update on this.

@azaslonov
Copy link
Member

azaslonov commented Dec 3, 2022

Hi @msrshahrukh100

I have exposed some settings (see design.config.json) in version 0.1.534. Hope that solves your problem.

Closing the issue. Please feel free to re-open should you still need assistance.

@msrshahrukh100
Copy link
Author

HI, @azaslonov
Thanks for the changes. It works absolutely fine for the icons, grid, and block snippets.
However, the file editors/scripts/paperbits.js also accesses config.json which it expects to be present at the root "/"
Will it be possible to replace this URL via the design.config.json?
Will it be a good idea to have a host config for all the resources? Just setting the host will fetch the resources from the host in the config rather than the current root.
Similarly for the index.html file the link and the script tags should contain URLs of the resources present at the host. Currently, it's editors/styles/paperbits.css

@azaslonov
Copy link
Member

Well, with config it's a bit different story. The config.json you're referring to is just a default implementation of ISettingsProvider interface. Therefore, if you'd like to customize that, you can create your own implementation and register it like:
injector.bindSingleton("settingsProvider", YourSettingsProvider); in startup.design.ts file.

@msrshahrukh100
Copy link
Author

ok alright, got it, thanks!
one last question about index.html. How can we add the host URL there?

@azaslonov
Copy link
Member

azaslonov commented Dec 4, 2022

The index.html file of the designer is not really inside packages, it is in top level project (like paperbits-demo or your own app): https://github.com/paperbits/paperbits-demo/blob/master/src/themes/designer/assets/index.html

So, you can change it right there. Does this solve it?

@msrshahrukh100
Copy link
Author

yes it does, thanks a lot!

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

2 participants