我想指出的是,我使用的是带有 Webpack 默认配置的经典 Symfony 应用程序。而且 watch 命令运行得非常好。
您好,当我尝试启动 Webpack Encore 开发服务器时,编译没有任何问题,但当我访问页面时,出现错误“Cannot GET /”。我在控制台中没有错误

(来源:casimages.com)
但有趣的是,http://localhost:8000/webpack-dev-server似乎有效。

(来源:casimages.com)
var Encore = require('@symfony/webpack-encore');
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
// only needed for CDN's or sub-directory deploy
//.setManifestKeyPrefix('build/')ne CSS file (e.g. app.css) if your JavaScript imports CSS.
*/
.addEntry('app', './assets/js/app.js')
//.addEntry('page1', './assets/js/page1.js') …Run Code Online (Sandbox Code Playgroud) 我与 Cypress 建立了一个 NuxtJS 项目。在我的测试中,我转到应用程序的其中一个页面,例如主页 (/)
describe('Index page', function () {
it('should show index page of app', function () {
cy.visit('/')
cy.get('h1.title').contains('frontend')
})
})
Run Code Online (Sandbox Code Playgroud)
因此,我需要启动我的开发服务器,以便能够构建我的 Nuxt 应用程序 (Vue),然后启动我的 e2e 测试。
问题是,当我启动它时(相当长,至少 15 秒),它不给我控制权,该进程保持活动状态,所以我无法启动我的纱线命令来运行测试。
describe('Index page', function () {
it('should show index page of app', function () {
cy.visit('/')
cy.get('h1.title').contains('frontend')
})
})
Run Code Online (Sandbox Code Playgroud)
结果,我真的不知道服务器正确启动后如何启动测试。
谢谢。
嗯,我有点矮胖。我会尽力尽可能清楚地解释我的问题。
我使用 Apollo 客户端来执行 GraphQL 查询。我也使用 NextJS。出于 SEO 原因,我有一个页面需要在服务器端呈现。
所以我有一个getProductFromSlug函数可以让我执行我的请求。
export const getProductFromSlug = async (slug: string) => {
try {
const { data, error } = await apolloClient.query<{
product: Product
}>({
query: GET_PRODUCT_BY_SLUG_QUERY,
variables: {
slug,
},
})
if (error) {
return { errors: [error.message] }
}
if (!('product' in data) || data.product === null) {
return { errors: ['Product with specified url not found'] }
}
return {
data,
}
} catch (error) {
// @ts-ignore …Run Code Online (Sandbox Code Playgroud) 我创建了一个新的NestJS 项目,它是一个非常流行的 NodeJS 框架。但是我的 IDE(PhpStorm 2020.2-Beta)上有这个错误(见标题)并且 ESLint 根本不起作用。
我使用过 NestJS CLI:
nest new nestjs-micro
Run Code Online (Sandbox Code Playgroud)
我似乎不是唯一遇到此问题的人,因此最好能找到此问题的原因并一劳永逸地解决它。
我已经有一个悬而未决的问题,但我还没有答案,这真的很成问题。
如果有人知道如何解决问题并保持与 PhpStorm 的 ESLint / Prettier 集成,谢谢。
再现
nest new nestjs-micro
Run Code Online (Sandbox Code Playgroud)
// tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
}
}
Run Code Online (Sandbox Code Playgroud)
版本
Typescript: 3.7.4
Node: 14.3.0
ESLint: 7.1.0
@typescript-eslint/parser: 3.0.2
Yarn: 1.22.4
Run Code Online (Sandbox Code Playgroud)