Closed omarceloribeiro closed 11 months ago
~~obs: just found that the line:
require("./blazorapp1/_framework/testeimg.png");
is not necessary. the webpack loader file-loader get those files even without that line in the webpart script.
so just having the files in /lib folder would resolve the problem.~~
edit: still need the require("./blazorapp1/_framework/testeimg.png");
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
solved the issue added copy-static-assets.json to config folder content:
{
"includeExtensions": [
"dll",
"br",
"gz",
"json",
"js",
"blat",
"wasm",
"dat",
"css",
"map",
"eot",
"otf",
"svg",
"ttf",
"woff",
"md",
"png"
]
}
But had to also add the png extension.
changed to this solution:
The gulp approach
let blazorCopy = build.subTask('blazorCopy', (gulp, buildOptions, done) => {
// make sure preBuild file will be copied again
gulp.src('./src/**/blazorapp1/**/*.*')
.pipe(gulp.dest('./lib/'));
// Don't forget to tell SPFx you are done
done();
})
source: How to copy files from src to lib folder in SPFx?
I believe this issue can be closed.
Glad you were able to resolve this yourself!
Correct -- the recommended way to copy extra files is to drop a copy-static-assets.json
in the config
folder. Writing a gulp task can work as well!
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues
What type of issue is this?
Question
What SharePoint development model, framework, SDK or API is this about?
π₯ SharePoint Framework
Target SharePoint environment
SharePoint Online
What browser(s) / client(s) have you tested
Additional environment details
βββ @fluentui/react@7.204.0 βββ @microsoft/eslint-config-spfx@1.17.4 βββ @microsoft/eslint-plugin-spfx@1.17.4 βββ @microsoft/rush-stack-compiler-4.5@0.5.0 βββ @microsoft/sp-build-web@1.17.4 βββ @microsoft/sp-component-base@1.17.4 βββ @microsoft/sp-core-library@1.17.4 βββ @microsoft/sp-lodash-subset@1.17.4 βββ @microsoft/sp-module-interfaces@1.17.4 βββ @microsoft/sp-office-ui-fabric-core@1.17.4 βββ @microsoft/sp-property-pane@1.17.4 βββ @microsoft/sp-webpart-base@1.17.4 βββ @rushstack/eslint-config@2.5.1 βββ @types/webpack-env@1.15.3 βββ ajv@6.12.6 βββ bindings@1.5.0 extraneous βββ eslint@8.7.0 βββ file-uri-to-path@1.0.0 extraneous βββ gulp@4.0.2 βββ nan@2.17.0 extraneous βββ tslib@2.3.1 βββ typescript@4.5.5
Issue description
Hi, please I need to pack some dll files, and other files extensions related to blazor app, to ClientSideAssets on appcatalog. So I need those files available in lib folder so I can use the webpack loader https://v4.webpack.js.org/loaders/file-loader/ to pack these files in solution package.
In the lib folder I can see some files inside _famework folder, like .json, and .js. But I can't see files like .dll, .br, .gz
after placing a require("dll file path") and running gulp bundle, this error is shown on console:
Seems like it only works with theses file extension above. I tried to add other file extesions to .eslintrc.js:
But not worked, still theses files are not shown in lib folder. They exists in src folder, but are not copied to lib folder. I can`t find what I am missing.
I tried with a png file and it worked:
result was: \dist\lib\webparts\helloWorld\blazorapp1_framework\testeimg.png
and inside .sppkg: \sharepoint\solution\app-1\ClientSideAssets\lib\webparts\helloWorld\blazorapp1_framework\testeimg.png
related to project: https://github.com/omarceloribeiro/spfxblazorwebpart (issue: https://github.com/omarceloribeiro/spfxblazorwebpart/issues/6)
Issue on sp-dev-docs: 9137 - Repository for implementation to add Blazor WASM as spfx webpart framework