Comments (6)
There should be no such error.
Just loaded a blank new created starter project:
npx -p yo -p generator-sppp -c 'yo sppp'
npm run connect
npm run build
npm run publish
![image](https://private-user-images.githubusercontent.com/7816483/274415977-00ac44c0-c0f6-4446-abc7-923e38587fdb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTI3MDU1NjcsIm5iZiI6MTcxMjcwNTI2NywicGF0aCI6Ii83ODE2NDgzLzI3NDQxNTk3Ny0wMGFjNDRjMC1jMGY2LTQ0NDYtYWJjNy05MjNlMzg1ODdmZGIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDQwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA0MDlUMjMyNzQ3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OWFhNjM5MjFjNjEyMDc2MDYzZTVkMGZjYjFlYTA0NzVhMGIwZjVlMzBkY2E5ODc5MjQzNjcxOTgxNzI4NTdkYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.7ylmyM2GHw8-uHwGPq-6l4U_TT4FIk4GB875Z_tqLHA)
No messages in console with the exception of those produced by SharePoint.
UPD:
You're using npm run start
, but it should be npm run build
.
from generator-sppp.
Also can see this string in bundled app.js:
from generator-sppp.
Hi @Gennady-G,
There is nothing special with the deployment. But one should never hardcode the URL, it's always relative and dynamic, based on the place it's run.
Same source code runs in a local workbench and production. You use context _spPageContextInfo.webAbsoluteUrl
for the legacy SharePoint pages. See: https://github.com/koltyakov/sp-rest-proxy#load-page-context-helper.
When running a build and deploy commands, the relative path is build to host JS/CSS/cewp.html in site assets folder.
from generator-sppp.
Also, in CEWP you should have {{ publishPath }}
:
![image](https://private-user-images.githubusercontent.com/7816483/274376113-7fb0c931-deb1-4d36-9e29-bfe84d421372.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTI3MDU1NjcsIm5iZiI6MTcxMjcwNTI2NywicGF0aCI6Ii83ODE2NDgzLzI3NDM3NjExMy03ZmIwYzkzMS1kZWIxLTRkMzYtOWUyOS1iZmU4NGQ0MjEzNzIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDQwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA0MDlUMjMyNzQ3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTQ4MzcxOTM5Y2Q3ZmFmODc2N2JmNmQ1ZTY5ZDA2OWVmZmE2MWFiMWExNWIwZGVlZDQ0M2FlZmIxNGRkYzQ5YiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.dqGM9Qh7cAsE2sLxJbH625_qQxGF4TVV2ISPhX8YLOs)
If changed to something else, it won't be updated when bundling.
from generator-sppp.
Hi Andrew!
I haven't touched the publishPath..
Interesting - tried to recreate new test project from scratch (the only difference - I used spf2 folder)
Tried Your code with no hard-coded urls:
import { sp, Web } from "@pnp/sp";
import { loadPageContext } from "sp-rest-proxy/dist/utils/env";
import { loadContext } from "@utils/env";
import { logger } from "@utils/logger";
import { setupPnp } from "@utils/odata";
loadContext()
.then(() => {
setupPnp();
const container = document.getElementById("example-cewp-container");
if (container) {
loadPageContext()
.then(async () => {
const web = new Web(_spPageContextInfo.webAbsoluteUrl);
console.log(_spPageContextInfo);
// test load items
(async () => {
const items = await web.lists.getByTitle("My list").items.select("Id", "FileLeafRef").filter("Id gt 7800").orderBy("Id", false).getAll();
console.log(`Got ${items.length} items here`);
})().catch((err) => {
console.log(err);
});
})
.catch(console.warn);
}
})
.catch(logger.error);
npm run connect
npm run start
npm run publish
and this behaviour repeats. It works Ok but tries to relate with localhost:9090:
Am I right that this error is only "the noise" and does not affect final solution?
from generator-sppp.
You're using npm run start, but it should be npm run build.
Yes, You are right! Sorry for stupid questions) Thank You Andrew as usual! :-D
from generator-sppp.
Related Issues (20)
- custom task are not working when created in the ./buils/tasks as per Documentations. HOT 1
- no site url? HOT 2
- spsave: Error occured when running gulp push HOT 2
- multi-factor authentication HOT 2
- cannot find module 'node-sass' HOT 9
- Publish to SP fails if there's a mandatory field to be set HOT 3
- Where are the gulp tasks? HOT 3
- Adding external libraries HOT 4
- Watch with multiple entry points HOT 3
- Migrate TSLint to ESLint configuration and dependencies
- How can I leverage the master page folder in this project? HOT 3
- Dev proxy and other webs HOT 2
- Request for SPPP deployment thru Azure Dev Ops sample HOT 2
- React development environment HOT 5
- SPPull is not a function HOT 1
- Include all script/components style files (scss/css) in build bundle. HOT 5
- dev server script directory HOT 5
- Question: what am I missing adding RTF-to-HTML third-party library? .. HOT 2
- File not found using sp.web.getFolderByServerRelativeUrl(folder).files.add(`test.rtf`, templateData, true); HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator-sppp.