Comments (6)
你是怎么引入ant.css的,在哪里引入的
from koa-web-kit.
您好,我是用下面这种方法引入的
文件:src/page/hot/hot.js
引入 import "antd/dist/antd.css"
from koa-web-kit.
在 webpack.config.ssr.js
里面的externals
里吧样式文件加入白名单试一下:
externals: [nodeExternals({
whitelist: [/\.(sa|sc|c)ss$/],
})],
from koa-web-kit.
您好,webpack.config.ssr.js配置为
const webpackConfig = webpackMerge(
{},
{
entry: {
ssr: utils.resolve('src/ssr/index.js'),
},
target: 'node',
mode: DEV_MODE ? 'development' : 'production',
output: {
path: utils.resolve('build/node'),
filename: '[name].js',
libraryExport: 'default',
libraryTarget: 'commonjs2',
},
externals: [nodeExternals({
whitelist: [/.(sa|sc|c)ss$/],
})],
resolve: {
...utils.getWebpackResolveConfig(),
},
module: {
rules: [
utils.getBabelLoader(true),
...utils.getAllStyleRelatedLoaders(
DEV_MODE,
false,
false,
undefined,
true
),
utils.getImageLoader(DEV_MODE, APP_PATH),
utils.getMediaLoader(DEV_MODE, APP_PATH),
],
},
plugins: [
new webpack.DefinePlugin({
isBrowser: false,
pathPrefix: JSON.stringify(prefix),
}),
new webpack.LoaderOptionsPlugin({
debug: DEV_MODE,
minimize: !DEV_MODE,
options: {
context: APP_PATH,
},
}),
// new MiniCssExtractPlugin({
// filename: "[name].css",
// chunkFilename: "[id].css"
// }),
],
}
);
还是有报错,报错信息如下:
$ npm run dev:ssr
[email protected] dev:ssr /home/code
cross-env ENABLE_HMR=0 CSS_MODULES=0 ENABLE_SSR=1 npm-run-all -p watch watch:ssr start
[email protected] watch /home/code
webpack --watch --progress --hide-modules --config config/webpack.config.dev.js
[email protected] watch:ssr /home/code
npm run ssr -- --watch
[email protected] start /home/code
nodemon --trace-warnings server.js
[email protected] ssr /home/code
webpack --progress --config config/webpack.config.ssr.js "--watch"
[nodemon] 1.18.10
[nodemon] to restart at any time, enter rs
[nodemon] watching: /home/code/api//* /home/code/config//* /home/code/build/node//* /home/code/routes//* /home/code/utils//* /home/code/services//* app-config.js server.js
[nodemon] starting node --trace-warnings server.js
Using [/home/code/config/app-config.js] as basic app configuration
Using [/home/code/config/app-config.js] as basic app configuration
Using [/home/code/config/app-config.js] as basic app configuration
10% building 0/0 modules 0 active
webpack is watching the files…
(node:58140) DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks
instead
10% building 0/1 modules 1 active .../app/spa/code/pc_koa_2.8.2/src/index.js 10% building 0/0 modules 0 active
webpack is watching the files…
11% building 9/13 modules 4 active ...@load 10% building 1/2 modules 1 active .../runtime/helpers/interopR 11% building 10/13 modules 3 active ...@loadable/component/dist/loadable.es.js 10% building 2/2 modules 0 11% building 11/13 modules 2 active ...@load 10% building 8/9 modules 1 active ...de/pc_koa_2.8.2/build/ap 11% building 14/36 modules 22 active ...spa 11% building 13/14 modules 1 active ...ool/schoolInfo/schoolHo 14% building 35/70 modules 35 active ...ages/School/schoolInfo/stuPlan/index.js 13% building 30/39 modules 21% building 93/125 modules 32 active ...l/schoolInfo/schoolHome/schoolHome.scss/home/code/node_modules/antd/dist/antd.css:15
body {
^
SyntaxError: Unexpected token {
at new Script (vm.js:83:7)
at createScript (vm.js:267:10)
at Object.runInThisContext (vm.js:319:10)
at Module._compile (internal/modules/cjs/loader.js:684:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
[nodemon] app crashed - waiting for file changes before starting...
21% building 93/147 modules 54 active ...es/School/schoolInfo/baosong/index.scss 23% building 112/166 modu
24% building 118/168 modules 50 active ...8.2/node_modules/object-assign/index.js 23% building 109/167 mod
26% building 136/174 modules 38 active ...School/schoolInfo/professional/index.js 24% building 123/182 mod
26% building 136/176 modules 40 active ...2/src/components/schoolInfo/schoolAd.js 24% building 124/182 mod
27% building 149/193 modules 44 active ...ol/schoolInfo/yuanxi/yuanxiContent.scss
from koa-web-kit.
用这个branch试一下,我试了下是可以的 https://github.com/JasonBoy/koa-web-kit/tree/issue%2325-demo
from koa-web-kit.
这个可以正常编译了,十分感谢
from koa-web-kit.
Related Issues (20)
- 关于路由代理修改确认 HOT 6
- build之后 npm run dev IE11以下 页面白屏,求解决。 HOT 9
- 报websocket的错误 HOT 1
- 接口代理数据,数据被截断 会是什么原因? HOT 10
- 我拆js的同时会把css也单独拆分,有什么办法能不拆分不css嘛?
- 如何解决chrome 报错问题? HOT 8
- offer a tinny case supporting the core feature HOT 1
- 目前遇到一个问题,就是转发的时候可能域名转发带有/ HOT 2
- 服务器端渲染 如果 /build 目录有两套build代码共存,为啥刷新两套分别显示 HOT 1
- Refused to execute script from 'https:///static/13-124.chunk.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled HOT 2
- webpack.config.node.js文件作用? HOT 2
- yarn install 之后 ,run dev 出现了这个问题。。 HOT 7
- 关于dev问题 HOT 1
- 代理返回blob对象 HOT 4
- Better Docker support
- Replace bash shell with nodejs script
- Add dotenv support HOT 1
- Add tailwindcss support, remove node sass HOT 1
- Dynamic routes from files structure
- Explore non bundling solution in dev mode
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 koa-web-kit.